protected inheritance
1 2 3 4 5 6 7 8 9 10 11
|
class Parent{
public:
int parentX = 6;
};
class Child :protected Parent{
public:
int childX = 5;
};
Parent *parent = new Child;
|
I'm getting an error because of the protected inheritance.
|
class Child :protected Parent
|
however public inheritance gives me no error.
Why can't Parent access to Child which is inheriting from protected Parent?
Last edited on
Topic archived. No new replies allowed.