/*An example of default constructors*/ #include #include using namespace std; class AorBorC { protected: string t; public: string type(){return t;} AorBorC(){ t = "?"; } }; class A: public AorBorC { public: A(){ t="A"; } }; class B: public AorBorC { public: B(){ t="B"; } }; class C: public AorBorC { public: C(){ t="C"; } }; int main() { AorBorC x; cout << x.type() << endl; A a; cout << a.type() << endl; B b; cout << b.type() << endl; C c; cout << c.type() << endl; AorBorC *p[]={&a, &b, &c, &x, NULL}; for ( int i=0; p[i]!=NULL; i++) cout << (p[i])->type() << "\n"; }