home *** CD-ROM | disk | FTP | other *** search
/ Using Visual C++ 4 (Special Edition) / Using_Visual_C_4_Special_Edition_QUE_1996.iso / ch14 / train3.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1995-10-30  |  700 b   |  33 lines

  1. // train3.cpp
  2.  
  3. #include <iostream.h>
  4. #include "templts.h"
  5. #include "contents.h"
  6.  
  7. void main()
  8. {
  9.     // At Station 1
  10.     Cow ACow;
  11.     Passenger APassenger("Monty");
  12.     
  13.     RailroadCar<Cow> CarNumber1(1, ACow);
  14.     RailroadCar<Passenger> CarNumber2(2, APassenger);
  15.     
  16.     CarNumber1.ShowContents();
  17.     CarNumber2.ShowContents();
  18.     
  19.     // Go to Station 2...
  20.     cout << "\n..Choo..Choo..\n\n";
  21.  
  22.     // At Station 2
  23.     Cow* AtStation2Cow = CarNumber1.Unload();
  24.     Passenger* AtStation2Passenger =
  25.         CarNumber2.Unload();
  26.  
  27.     cout << "How was the trip, ";
  28.     cout << AtStation2Passenger->GetName() << " ?";
  29.     cout << "  " << AtStation2Passenger->Complain();
  30.     cout << "\n";
  31.     cout << AtStation2Cow->Moo() << "\n";
  32. }
  33.