Saturday, November 27, 2010

Base Class Access Specfiers

The private base classes of: class A : B, public C, D, private E, F {}; are B, D, E, and F.

The access specifiers: public, protected, and private are only associated with the immediately next class. This is different than when access specifiers are used with members, where an access modifier affects all members after it in a class, until another access modifier is seen by the compiler.

Public inheritance is usually associate with the ISA relationship, where as private inheritance is associated with the implemented-in-terms-of relationship. The use of protected inheritance is not as understandable, in terms of connecting it with a relationship, but protected inheritance allows the derived class to access all of the public and protected data of the base class. By members, I mean member functions and member data.

No comments:

Post a Comment