// constructors and derived classes // Although the constructors and destructors of the base class are not inherited // themselves, its default constructor (i.e., its constructor with no parameters) // and its destructor are always called when a new object of a derived class is // created or destroyed. #include using namespace std; class mother { public: mother () { cout << "mother: no parameters\n"; } mother (int a) { cout << "mother: int parameter\n"; } }; class daughter : public mother { public: daughter (int a) { cout << "daughter: int parameter\n\n"; } }; class son : public mother { public: // If the base class has no default constructor or you want that an overloaded // constructor is called when a new derived object is created, you can specify it // in each constructor definition of the derived class. son (int a) : mother (a) { cout << "son: int parameter\n\n"; } }; int main () { daughter cynthia (0); son daniel(0); getchar(); return 0; }