|
|
 |
|
|
|
|
270: // now walk the list and show the Object
271: cout << \n ;
272: ListOfCats.ShowAll();
273: cout << \n ;
274: ListOfData.ShowAll();
275: cout << \n ************ \n\n ;
276: return 0; // The lists fall out of scope and // are destroyed!
277: } |
|
|
|
|
|
|
|
|
What value? (0 to stop): 5
What value? (0 to stop): 13
What value? (0 to stop): 2
What value? (0 to stop): 9
What value? (0 to stop): 7
What value? (0 to stop): 0 |
|
|
|
|
|
|
|
|
This cat is 2 years old
This cat is 5 years old
This cat is 7 years old
This cat is 9 years old
This cat is 13 years old |
|
|
|
|
|
|
|
|
Deleting Data object with value: 13
Deleting Data object with value: 9
Deleting Data object with value: 7
Deleting Data object with value: 5
Deleting Data object with value: 2
Deleting 13 years old Cat.
Deleting 9 years old Cat.
Deleting 7 years old Cat.
Deleting 5 years old Cat.
Deleting 2 years old Cat. |
|
|
|
|
|
|
|
|
Analysis: The first thing to notice is the striking similarity to the listing in Hour 19. Go ahead, find the original listing; I'll wait right here. As you can see, little has changed. |
|
|
|
|
|
|
|
|
The biggest change is that each of the class declarations and methods is prepended with |
|
|
|
|
|