Additional Topics on Inheritance

Explore how inheritance affects member accessibility and learn to manage constructor execution chains between base and derived classes.

Inheritance is a powerful feature, but it comes with specific rules regarding member visibility and object initialization. This lesson explores which members are accessible to derived classes and how constructors are executed in an inheritance hierarchy.

Access the base class members

Inheritance facilitates code reuse, but we must determine exactly which members are inherited. We can answer this by trying to access base class members. Let’s consider an example: