- Why do we need inheritance in C++?
Inheritance involves creating new objects by directly acquiring the attributes and behaviors of other objects and then extending or specializing them.
- Give a simple example of objects in the real world that could be modelled in C++ using inheritance.
The first step level could be life on earth, the next levels could be plants (trees, flowers), animals (warm blooded and cold blooded) and humans (woman and man)
- What is a superclass and what is a subclass?
Superclass is the parent from with the subclass (child) inherits the information
- How would you write a public inheritance in C++?
Public inheritance is written by writing a keyword “class” and defining it, then comes the colon and keyword “public” and the class from which to inherit. As in the example below:

- In what ways can a subclass extend the functionality of a superclass?
Subclass can extend the functionality of a superclass by having functionalities written after the subclass definition and inheritance line in the {} brackets, as in the example above. For example, m-battingAverage(); s a functionality of a subclass BaseballPlayer but is not accessible in Person.