next up previous contents
Next: Exercises: Up: Using the CELL Classes: Previous: Application Code:

Annotated Output:

CHAR_SL_CELL test
In explict CHAR_SL_CELL<charR1> constructor.
Exit explict CHAR_SL_CELL<charR1> constructor.
In explict CHAR_SL_CELL<charR2> constructor.
Exit explict CHAR_SL_CELL<charR2> constructor.

I-->J.


Deleting R1 by delete &R1
     In CHAR_SL_CELL<charR1> destructor 
     Exit CHAR_SL_CELL destructor 


Deleting R2 by delete &R2
         In CHAR_SL_CELL<charR2> destructor 
         Exit CHAR_SL_CELL destructor 

Leaving scope

             In CHAR_SL_CELL<charR2> destructor 
             Exit CHAR_SL_CELL destructor 
                 In CHAR_SL_CELL<charR1> destructor 
                 Exit CHAR_SL_CELL destructor



CHAR_DL_CELL<int> test
In explict CHAR_SL_CELL<intV1> constructor.
Exit explict CHAR_SL_CELL<intV1> constructor.
In explict CHAR_DL_CELL<intV1> constructor.
Exit explict CHAR_DL_CELL<intV1> constructor.
In explict CHAR_SL_CELL<intV2> constructor.
Exit explict CHAR_SL_CELL<intV2> constructor.
In explict CHAR_DL_CELL<intV2> constructor.
Exit explict CHAR_DL_CELL<intV2> constructor.

20<-->10.

Let's examine the destructor output for the CHAR_DL_CELL linked objects, V1 and V2. Our destructors here destroy V2 and V1 separately. The destructor for CHAR_DL_CELL is called first, followed by the destructor call to CHAR_SL_CELL.

Deleting V2 by delete &V2
In CHAR_DL_CELL<intV2> destructor 
Exit CHAR_DL_CELL destructor 
     In CHAR_SL_CELL<intV2> destructor 
     Exit CHAR_SL_CELL destructor 


Deleting V1 by delete &V1
  In CHAR_DL_CELL<intV1> destructor 
  Exit CHAR_DL_CELL destructor 
         In CHAR_SL_CELL<intV1> destructor 
         Exit CHAR_SL_CELL destructor 

Leaving scope

    In CHAR_DL_CELL<intV2> destructor 
    Exit CHAR_DL_CELL destructor 
             In CHAR_SL_CELL<intV2> destructor 
             Exit CHAR_SL_CELL destructor 
      In CHAR_DL_CELL<intV1> destructor 
      Exit CHAR_DL_CELL destructor 
                 In CHAR_SL_CELL<intV1> destructor 
                 Exit CHAR_SL_CELL destructor



Jim Peterson
1999-04-22