c++ - Is this true about inheritance? -
regardless of whether public, private or protected inheritance, private members of base class not accessible functions exclusive derived class.
this conclusion. correct?
related notes appreciated.
also, in private inheritance, public members of base class private in derived class new functions of derived class can still access them directly. correct?
class base { private: int a; }; // private inheritance. class : private base { public: a() { = 0; } };
this gives me:
error: 'int base::a' private
the type of inheritance not matter when comes ability class access it's base-classes private variables.
Comments
Post a Comment