C++ Inheritance & Polymorphism: Using Inheritance for is-a Relationships

placeholder

Inheritance is a powerful object-oriented language construct in which one class can be related to another class using an is-a relationship. Using inheritance you can construct complicated class hierarchies in which one class is a parent or a base of another class. Is-a relationships are a great way of performing object-oriented design and are complemented by has-a relationships which are implemented using composition rather than inheritance. Explore inheritance relationships by setting up an inheritance hierarchy in C++ and specifying one class as the parent of another class. Then discover how member variables and methods are accessible from the drive class as well as from external code. Finally investigate base class access specifiers and find out how they work with member access specifiers. When you’re finished you’ll clearly understand how to use inheritance for is-a relationships and how to identify uses for private inheritance.