Course Content
Programming Language C Plus Plus
About Lesson
Inheritance – Acquire the members of existing class into new one.
Existing class – Parent class or base class or super class
New class – Child class or Derive class or sub class

 

child class has all the members of parent class but it also has new one.
Inheritance Types
Single Level
A
|
B
……..  Multi Level
A
|
B
|
C
————–Multiple Inheritance
A…..B
   |
   C
———- Hierarichal
A
|
B—-C
|    |
D    E
     | —
     F  G
————— Hybrid Inheritance

 

Multiple + Multi Level
A
|
B
|
C —D
   |
   E

 

Syntax:

 

class Parent
{
   private:
    …..

 

   protected:
   ……

 

   public:
    ……
};
class Child : public Parent
{
   private:
   …..
   protected:
   …….
   public:
   …..
};