/* Filename: try2.cpp Author: Br. David Carlson Date: July 5, 1998 Last Revised: November 26, 2001 This test program creates a few objects of type Product and prints their contents on the screen. It also changes the price of one product, showing the results on the screen. The Product class's "get" functions are used to extract the values of the three fields of one of the objects, with the results printed on the screen. Tested with: Microsoft Visual C++ 6.0 Microsoft Visual C++ .NET g++ under Linux */ #include "product2.h" int main(void) { ShortString Result; Product ProductA("toaster, 4 slice", 1997, 91.98); Product ProductB; // use default values Product ProductC("mixer, 5 speed", 1998, 32.95); cout << "ProductA:" << endl; ProductA.Print(); cout << "ProductB:" << endl; ProductB.Print(); cout << "ProductC:" << endl; ProductC.Print(); cout << "Press ENTER to go on" << endl; cin.get(); ProductA.ChangePrice(87.95); cout << "After changing the price on ProductA we have:" << endl; ProductA.Print(); // Let's get the values of the three fields individually: ProductA.GetName(Result); cout << "Name of ProductA: " << Result << endl; cout << "Year made for ProductA: " << ProductA.GetYear() << endl; cout << "Price of ProductA: " << ProductA.GetPrice() << endl << endl; return 0; }