1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
|
class Vector2D
{ int x,y;
public:
Vector2D () : x(0), y(0)
{}
Vector2D (int _x, int _y) : x(_x), y(_y) // 2 arg constuctor
{}
};
class Vector3D : public Vector2D
{ int z;
public:
Vector3D() : z(0) // Invokes Vector2D's default constructor
{}
Vector3D(int x,int y,int _z) : Vector2D(x,y), z(_z) // 3 arg constructor
{}
};
class Vector4D: public Vector3D
{ int t;
public:
Vector4D() : t(0) // Invokes Vector3D's default constructor
{}
Vector4D(int x,int y,int z,int _t) : Vector3D(x,y,z), t(_t) // 4 arg constructor
{}
};
|