what is the diffrent between private, protected and public inheritance [duplicate]

This question already has an answer here:

I couldn’t find this answer on the internet. What is the diffrent between B,C and D, what can class D can do that B and C can’t, or what can class B can do that class C can’t

class A{
public:...
protected:...
private:...
}
class B:private A{
public:...
protected:...
private:...
}

class C: protected A{
public:...
protected:...
private:...
}

class D: public A{
public:...
protected:...
private:...
}


Source: oop

Leave a Reply