12345678910111213141516171819202122
class MY_CLASS { // Constructor. MY_CLASS( int nInit ) { // Allocate memory from the heap. this -> m_pMyVariable = new int( nInit ); } // Destructor. ~MY_CLASS( void ) { if( this -> m_pMyVariable != NULL ) { delete this -> m_pMyVariable; } } int *m_pMyVariable; };
delete this -> m_pMyVariable;
this->
m_pMyVariable