topical media & game development

talk show tell print


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

  // Ex9_07.cpp (the same as Ex9_06.cpp)
  // Using a virtual function 
  include <iostream>
  include <GlassBox.h>                  // For CBox and CGlassBox
  using std::cout;
  using std::endl;
  int main()
    CBox myBox(2.0, 3.0, 4.0);           // Declare a base box
    CGlassBox myGlassBox(2.0, 3.0, 4.0); // Declare derived box - same size
    myBox.ShowVolume();                  // Display volume of base box
    myGlassBox.ShowVolume();             // Display volume of derived box
    cout << 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.