#include <iostream.h> class XY { protected: int x, y; public: XY(int X, int Y) { x = X; y = Y; } int getX() { return x; } int getY() { return y; } }; class XYZ : public XY { protected: int z; public: // derived class constructors XYZ(int X, int Y, int Z) : XY(X, Y) { z = Z; } int getZ() { return z; } }; void main() { XYZ point1(10,20,30); cout << "x: " << point1.getX() << endl; cout << "y: " << point1.getY() << endl; cout << "z: " << point1.getZ() << endl; }