Mega Code Archive

 
Categories / C++ / Class
 

Public inheritance from three parent classes

#include <iostream> using namespace std; class One{  public:   One(void) { cout << "Constructor for One\n"; }; }; class Two{  public:   Two(void) { cout << "Constructor for Two\n"; }; }; class Three {  public:   Three(void) { cout << "Constructor for Three\n"; }; }; class Derived: public One, public Three, public Two  {  public:    Derived(void) : One(), Two(), Three()     {      cout << "Derived constructor called\n";     }; }; int main(void) {    Derived my_class; }