// File: cctest4.cpp // // Use the ColorCube class. // Check passing dervied objects by value. // Uses separate compilation. #include #include "ColorCube.h" using namespace std ; void bar1(ColorCube cc) { // pass by value cc.identify() ; return ; } void bar2(Cube c) { // pass by value c.identify() ; return ; } void bar3(Box b) ; // pass by value int main() { ColorCube cc(1.2, ColorCube::blue) ; // use alternate constructor cout << "bar1: " ; bar1(cc) ; cout << "bar2: " ; bar2(cc) ; cout << "bar3: " ; bar3(cc) ; cout << "\n\nSizes:\n" ; cout << " sizeof(Box) = " << sizeof(Box) << endl ; cout << " sizeof(Cube) = " << sizeof(Cube) << endl ; cout << " sizeof(ColorCube) = " << sizeof(ColorCube) << endl ; }