Interview Questions   Tutorials   Discussions   Programs   Videos   

C++ - What is multi level inheritance give an example




238
views
asked marvit August 18, 2014 11:19 AM  

What is multi level inheritance give an example


           

1 Answers



 
answered By bhjahnavi   0  
Deriving a new class which is derived from another class is known as multi level inheritance.
consider the following simple example given below.
/* a simple program to demonstrate multi level inheritance*/
#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 c;
  c.display();
  return 0;
}

flag   
   add comment

Your answer

Join with account you already have

FF

Preview


Ready to start your tutorial with us? That's great! Send us an email and we will get back to you as soon as possible!

Alert