In this chapter, we discuss some of the fundamental building blocks of object-oriented programming, such as inheritance and polymorphism.
25.1 Inheritance
We can build a class from an existing class. It is said that a class can be
derived from an
existing class. This is known as
inheritance and is one of the pillars of object-oriented programming, abbreviated as OOP. To derive a class from an existing class, we write:
class MyDerivedClass : public MyBaseClass {};
A simple example would be:
class MyDerivedClass : public MyBaseClass
{