Multiple Inheritance in c++ Example

  GNU nano 2.9.1                                                                     test.cpp                                                                      Modified  

/********************************************************************************************************
*************Designed and Developed by V2Geeks******************************************
********************************************************************************************************/
 // Example of  
Multiple  Inheritance in c++ Example
Multiple Inheritance (A->C and B->C)
#include<iostream.h> #include<conio.h> class A { public: void display() { cout<<"Hello from A \n"; } }; class B { public: void show() { cout<<"Hello from B \n"; } }; class C : public A, public B // now C is child of Both A and B { // now C have display function of it's parent class A // and now C show function of it's parent class B }; void main() { C objC; //object of class C clrscr(); objC.display(); objC.show(); getch(); }
Reactions: