Accessing Base Components of a Derived Class Object

Now things become less intuitive and more convoluted. Members and friends of a derived class do receive access to all data members and member functions of this derived class. They also receive some access to data members and member functions of the base class. They have access to public and protected members only, not to private data members and member functions of the base class. They also do not receive access to members of other classes derived from the same base class.

One of the ways to look at this rule is that the base class has three kinds of clients (or three areas of access). In the inner area, with the greatest right to access data members and member functions, are class member functions ...

Get Core C++ A Software Engineering Approach now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.