// File: cube.C // // Implementation of the Cube derived class #include #include #include #include "cube.h" // Default constructor // Note: default constructor for Box is called already. // Cube::Cube() { #ifndef NDEBUG cerr << "Default Cube constructor, this = " << this << endl ; #endif length = height = width = 1.0 ; // sides have length 1.0 by default } // create a cube with equal sides // Note: default constructor for Box is called already. Cube::Cube(float side) { #ifndef NDEBUG cerr << "Alternate Cube constructor, this = " << this << endl ; #endif length = height = width = side ; } // Destructor // Cube::~Cube() { #ifndef NDEBUG cerr << "Cube destructor, this = " << this << endl ; #endif // Do nothing } // report vital stats for cubes // void Cube::identify() { cout << "I'm a cube. Each side has length=" << length << ". Serial number = " << serial() << endl ; }