Inheritance is one of the key feature of object-oriented programming including C++ which allows user to create a new class (derived class) from a existing class(base class). The derived class inherits all feature from a base class and it can have additional features of its own.
C++ program to implement Inheritance (Multilevel 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; }
Check out – All CSE Basic Practicals
Thanks for visiting us. Do share us among your friends.
C++ program to implement Inheritance – Computer Practical