How should I delete this?
How should I delete this:
COctree *child[8];
I guess it could be any class, but it, as you guesses, Recursion.
its like
class COctree {
COctree *child[8];
};
How should the constructor look for this class?
A:
for( int i=0; i<8; i++ )
{
if( child != NULL ) delete child<i>; <br>}<br><br>skip the "if", if all nodes has been allocated.<br><br>B: , my guess<br><br>contructor:<br><br>COctree::COctree()<br>{<br>for( int i=0; i<8; i++ )<br>{<br>child=NULL; <br>}<br>}<br><br>destructor:<br><br>COctree::~COctree()<br>{<br>for( int i=0; i<8; i++ )<br>{<br> if( child != NULL ) delete child; <br>}<br>}<br><br> <br><br>Edited by - Claus Hansen Ries on July 27, 2000 3:14:17 AM </i>
for( int i=0; i<8; i++ )
{
if( child != NULL ) delete child<i>; <br>}<br><br>skip the "if", if all nodes has been allocated.<br><br>B: , my guess<br><br>contructor:<br><br>COctree::COctree()<br>{<br>for( int i=0; i<8; i++ )<br>{<br>child=NULL; <br>}<br>}<br><br>destructor:<br><br>COctree::~COctree()<br>{<br>for( int i=0; i<8; i++ )<br>{<br> if( child != NULL ) delete child; <br>}<br>}<br><br> <br><br>Edited by - Claus Hansen Ries on July 27, 2000 3:14:17 AM </i>
Ries
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement