topical media & game development

talk show tell print

basic-program-code-09-Ex9-05-Ex9-05.c

? / basic-program-code-09-Ex9-05-Ex9-05.c


  // Ex9_05.cpp
  // Using a derived class copy constructor
  
  // You need to uncomment the copy constructor code in CandyBox.h...
  
  include <iostream>                    // For stream I/O
  include <cstring>                     // For strlen() and strcpy()
  include <CandyBox.h>                  // For CBox and CCandyBox
  using std::cout;
  using std::endl;
  
  int main()
  {
    CCandyBox chocBox(2.0, 3.0, 4.0, "Chockies");  // Declare and initialize
    CCandyBox chocolateBox(chocBox);               // Use copy constructor
  
    cout << endl
         << "Volume of chocBox is " << chocBox.Volume()
         << endl
         << "Volume of chocolateBox is " << chocolateBox.Volume()
         << endl;
  
    return 0;
  }
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.