Search⌘ K

Base Class and Derived Class

Explore the concepts of base and derived classes in C++ inheritance. Understand how public inheritance allows derived classes to access and reuse public and protected members from the base class, improving code organization and reuse.

In the last lesson, we have seen that Vehicle class attributes are shared by the other two classes(Car and Ship).

Vehicle as a Base Class

We can consider the Vehicle class as a base class as it has common attributes.

Derived Classes

Cars and Ships are considered as derived classes as they’re inheriting properties from vehicle ...