#ifndef BOX_H #define BOX_H #include "Rectangle.h" //class functions defined in line in this header file //you could put them into an implementation file (.cpp) and //should do so, if they are large. //Here is the inheritance syntax! Box is a Rectangle! class Box : public Rectangle { private: double height; double volume; public: // Default constructor sets object data by default Box() : Rectangle() { height = 1.0; volume = 1.0; } // Parameterized constructor sets object data values // Notice how it also sends values to the parent class Rectangle Box(double w, double len, double h) : Rectangle(w, len) { height = h; volume = getArea() * h; //notice call to parent member function } double getHeight() const { return height; } double getVolume() const { return volume; } }; #endif