// inheritance example // constructors and derived classes #include #include 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: son(int a) : mother (a) { cout<<"son:int parameter\n\n"; } }; void main() { clrscr(); daughter d1(0); son s1(0); getch(); } /* ----OUTPUT---- mother: no parameters daughter: int parameter mother: int parameter son: int parameter */