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 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43
|
class Shape
{
public:
Shape();
Shape(float x, float y, float z, bool v);
virtual ~Shape();
virtual const char* Name() const;
virtual float Volume() const;
virtual float Area() const;
protected:
float x_, y_, z_;
bool verbose_ = 0;
private:
Shape (const Shape&);
Shape& operator= (const Shape&);
};
class Box : public Shape
{
public:
Box();
Box(float width, float length, float height, bool v);
virtual ~Box();
const char* Name () const;
float Volume() const;
float Area() const;
};
class Van : public Truck, public Box
{
public:
Van();
Van(const char*, unsigned int, char*, float w, float l, float h, bool v);
virtual ~Van();
float LoadCapacity() const; // returns volume of box
const char* ShortName() const; // returns "VAN"
private:
Van(const Truck&);
Van& operator=(const Van&);
};
|