Reputation: 2435
suppose I have this code:
class D : public Base1, Base2 {}
My question is. Obviously class D is public derived from Base1, but what about Base2? Is is private derived? Or also public derived?
I checked some websites but I did no find article about this. thank you!
Upvotes: 1
Views: 86
Reputation: 3764
If I remember correctly Base2 is private by default however you can specify access for that one as well, as in this example:
class D : public Base1, public Base2 {};
Upvotes: 0
Reputation: 2289
Private. Unless it's declared as public, it will always be private by default.
Upvotes: 0
Reputation: 34665
Class members are private by default and that holds for inheritance too. Also, class definition should end with a ;
.
Upvotes: 3
Reputation: 9523
It's private derived, inheritance method should be declared for each base class individually, if not, then it's private by default.
Upvotes: 3