// A1_10.cpp #include using namespace std; // This is what is required if X, Y, and Z are not related to C class X { public: X() { cout << "\n constructing X with no arguments"; } }; class Y { public: Y() { cout << "\n constructing Y with no arguments"; } }; class Z { public: Z() { cout << "\n constructing Z with no arguments"; } }; class C { public: C(const X &x) { cout << "\n promoting X object to C"; } C(const Y &x) { cout << "\n promoting Y object to C"; } C(const Z &x) { cout << "\n promoting Z object to C"; } }; /* This is what is required if X, Y, and Z inherit from C class C { public: C() { cout << "\n constructing C with no arguments"; } C(const C &c) { cout << "\n copying C object"; } }; class X : public C { public: X() { cout << "\n constructing X with no arguments"; } }; class Y : public C { public: Y() { cout << "\n constructing Y with no arguments"; } }; class Z : public C { public: Z() { cout << "\n constructing Z with no arguments"; } }; */ void main() { C c[3] = { X(), Y(), Z() }; cout << "\n\n"; }