33: cout << “Simple Cat Destructor...” << endl;
34: }
35:
36: const SimpleCat * const FunctionTwo
37: (const SimpleCat * const theCat);
38:
39: int main()
40: {
41: cout << “Making a cat...” << endl;
42: SimpleCat Frisky;
43: cout << “Frisky is “ ;
44: cout << Frisky.GetAge();
45: cout << “ years old” << endl;
46: int age = 5;
47: Frisky.SetAge(age);
48: cout << “Frisky is “ ;
49: cout << Frisky.GetAge();
50: cout << “ years old” << endl;
51: cout << “Calling FunctionTwo...” << endl;
52: FunctionTwo(&Frisky);
53: cout << “Frisky is “ ;
54: cout << Frisky.GetAge();
55: cout << “ years old” << endl;
56: return 0;
57: }
58:
59: // functionTwo, passes a const pointer
60: const SimpleCat * const FunctionTwo
61: (const SimpleCat * const theCat)
62: {
63: cout << “Function Two. Returning...” << endl;
64: cout << “Frisky is now “ << theCat->GetAge();
65: cout << “ years old “ << endl;
66: // theCat->SetAge(8); const!
67: return theCat;
68: }
Making a cat...
Simple Cat constructor...
Frisky is 1 years old
Frisky is 5 years old
Calling FunctionTwo...
FunctionTwo. Returning...
Frisky is now 5 years old
Frisky is 5 years old
Simple Cat Destructor...
OUTPUT
276 Day 9
LISTING9.11 continued