home *** CD-ROM | disk | FTP | other *** search
/ C by Discovery (4th Edition) / C_By_Discovery_4th_Edition.tar / C_By_Discovery_4th_Edition / _DISK_ / ch12 / invMain.cpp < prev    next >
C/C++ Source or Header  |  2005-06-16  |  997b  |  33 lines

  1. //             invMain.cpp
  2. //
  3. // Synopsis  - Creates invItem objects with different constructors.
  4. //
  5. // Objective - To illustrate constructors and destructors.
  6.  
  7. // Include Files
  8. #include <iostream.h>
  9. #include "invItem.h"
  10.  
  11. int main()
  12. {
  13.     invItem default_item;                            // Note 1
  14.     cout << "Initial values for default_item: ";
  15.     default_item.display();
  16.     default_item.changeId( "AB1111F" );
  17.     default_item.changeNum( 50 );
  18.     cout << "Modified values for default_item: ";
  19.     default_item.display();
  20.     invItem copied_item( default_item );             // Note 2
  21.     cout << "Initial values for copied_item: ";
  22.     copied_item.display();
  23.     
  24.     invItem another_item( "A1234H" );                // Note 3
  25.     cout << "Initial values for another_item: ";
  26.     another_item.display();
  27.     invItem another_copy = another_item;             // Note 4
  28.     cout << "Initial values for another_copy: ";
  29.     another_copy.display();
  30.     
  31.     return 0;
  32. }
  33.