Go back to Richel Bilderbeek's homepage.

Go back to Richel Bilderbeek's C++ page.

 

 

 

(C++) delete a pointer-to-const

 

Be aware that you can delete a pointer-to-const:

 

 

//Create a read-only MyClass

const MyClass * const myClass = new MyClass;

 

delete myClass; //VALID C++ CODE!

 

 

 

See exercise #2: a foolproof function for the implications and prevention of this.

 

 

Go back to Richel Bilderbeek's C++ page.

Go back to Richel Bilderbeek's homepage.