|
|
 |
|
|
|
|
23:
24: SimpleCat::~SimpleCat()
25: {
26: cout << Simple Cat Destructor\n;
27: }
28:
29: SimpleCat FunctionOne (SimpleCat theCat);
30: SimpleCat* FunctionTwo (SimpleCat *theCat);
31:
32: int main()
33: {
34: cout << Making a cat\n;
35: SimpleCat Frisky;
36: cout << Calling FunctionOne\n;
37: FunctionOne(Frisky);
38: cout << Calling FunctionTwo\n;
39: FunctionTwo(&Frisky);
40: return 0;
41: }
42:
43: // FunctionOne, passes by value
44: SimpleCat FunctionOne(SimpleCat theCat)
45: {
46: cout << Function One. Returning\n;
47: return theCat;
48: }
49:
50: // functionTwo, passes by reference
51: SimpleCat* FunctionTwo (SimpleCat *theCat)
52: {
53: cout << Function Two. Returning\n;
54: return theCat;
55: } |
|
|
|
|
|
|
|
|
1: Making a cat
2: Simple Cat Constructor
3: Calling FunctionOne
4: Simple Cat Copy Constructor
5: Function One. Returning
6: Simple Cat Copy Constructor
7: Simple Cat Destructor
8: Simple Cat Destructor
9: Calling FunctionTwo
10: Function Two. Returning
11: Simple Cat Destructor |
|
|
|
|
|
|
|
|
The line numbers shown here will not print. They were added to aid in the analysis. |
|
|
|
|
|
|