Multiple Inheritance In cpp

Multiple Inheritance In cpp

PROGRAM:
  1. #include<iostream>
  2. using namespace std;
  3. class A{
  4. public:
  5. A(){
  6. cout<<"\n parent1";
  7. }
  8.  
  9. };
  10. class B{
  11. public:
  12. B(){
  13.  
  14. cout<<"\n parent1";
  15. }
  16. };
  17. class C:public A,public B{
  18. public:
  19. C(){
  20. cout<<"\n child";
  21. }
  22. };
  23.  
  24. int main(){
  25. C c;
  26. return 0;
  27. }
  28.  

Comments

Popular posts from this blog

Introduction to ChatGPT: Explain what ChatGPT is, how it works, and what it is used for.

Multi Level Inheritance In cpp

Hybrid Inheritance In cpp