Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

multiple inheritance c++

#include<iostream>
using namespace std;
 
class A
{
public:
  A()  { cout << "A's constructor called" << endl; }
};
 
class B
{
public:
  B()  { cout << "B's constructor called" << endl; }
};
 
class C: public B, public A  // Note the order
{
public:
  C()  { cout << "C's constructor called" << endl; }
};
 
int main()
{
    C c;
    return 0;
}
Source by www.geeksforgeeks.org #
 
PREVIOUS NEXT
Tagged: #multiple #inheritance
ADD COMMENT
Topic
Name
7+3 =