Multilevel Inheritance in C++

Multilevel Inheritance in C++

Multilevel Inheritance in C++

MULTILEVEL INHERITANCE : In this type of inheritance the derived class inherits from a
class, which in turn inherits from some other class. The Super class for one, is sub class for the other.

SYNTAX :

class A // base class
{
    ...........
};
class B : access_specifier A // derived class
{
    ...........
} ;
class C : access_specifier B // derived from derived class B
{
    ...........
} ;



CODE:
#include <iostream>
using namespace std;

class A {
public:
    void display() {
        cout<<"Base class content.";
    }
};

class B : public A {};

class C : public B {};

int main() {
    C obj;
    obj.display();
    return 0;
} 



OUTPUT :
Base class content.

 


 

Topics Covered :

 

  • inheritance
  • multilevel
  • multi-level
  • multilevel inheritance in c++
  • inheritance in c++

 

 


 

 


 

Thanks for reading this blog. Hope you get satisfied with the blog and definitely this blog must have valued your time and effort of reading.

Take a time to connect our other digital creations such as Instagram , Facebook and Youtube.

 

πŸ§‘β€πŸ’»πŸ§‘β€πŸ’»Β Social MediaΒ LinksΒ ofΒ Tech DCodeΒ :

πŸ‘‰πŸ»Β YouTube :Β https://www.youtube.com/channel/UCjJnEdeugftBwQ3yMuD4B_A
πŸ‘‰πŸ»Β Instagram :Β https://www.instagram.com/thetechdcode/
πŸ‘‰πŸ»Β Facebook Page :Β https://www.facebook.com/thetechdcode
πŸ‘‰πŸ»Β Twitter :Β https://twitter.com/thetechdcode
πŸ‘‰πŸ»Β Telegram Channel :Β https://t.me/thetechdcode
πŸ‘‰πŸ»Β Tech DCode Linktree :Β https://linktr.ee/thetechdcode
πŸ‘‰πŸ»Β My Personal Handles :Β https://linktr.ee/virtualshivamin

πŸ§‘β€πŸ’»πŸ§‘β€πŸ’»Β Social Media LinksΒ ofΒ SHIVAM SINGHΒ (OWNER) :

πŸ‘‰πŸ»Β Instagram :Β https://www.instagram.com/virtualshivamin/
πŸ‘‰πŸ»Β Facebook Page :Β https://www.facebook.com/virtualshivamin/
πŸ‘‰πŸ»Β Twitter :Β https://twitter.com/virtualshivamin/
πŸ‘‰πŸ»Β Personal Linktree :Β https://linktr.ee/virtualshivaminΒ 

 

 

Leave a Reply

Your email address will not be published. Required fields are marked *