/* File: cube.C Implementation of the Cube derived class */ #include #include #include "cube.h" /* default constructor Note: default constructor for Box is called already. */ Cube::Cube() { printf("Cube debug: l=%f h=%f w=%f\n", length, height, width) ; debug() ; 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) { printf("Cube debug: l=%f h=%f w=%f\n", length, height, width) ; debug() ; length = height = width = side ; } /* report vital stats for cubes */ void Cube::identify() { printf("I'm a cube. Each side has length=%f\n", length) ; }