1.We need inheritance because involves creating new objects by directly acquiring the attributes and behaviors of other objects and then extending or specializing them.
2.Boat
-1. fishing boat
-1.1 middle console fishing boat
-1.2 dual console fishing boat
-2. luxury boat
-2.1 express luxury boat
-2.2 cruiser luxury boat
- In an inheritance (is-a) relationship, the class being inherited from is called the parent class , base class , or superclass , and the class doing the inheriting is called the child class , derived class , or subclass
- âclass SubClass : public SuperClassâ
- When a subClass extends from a superClass, gets all the functionalities of the superClass that are public or protected and can add more functionalities.