PROBLEM: hlf@nic.cerf.net (Howard Ferguson),
I wish to define a class in a library which the library user
can create by dynamic allocation via the new operator, but
I want to prevent him from creating automic instances.
RESPONSE: nikki@trmphrst.demon.co.uk (Nikki Locke), 6 Jan 93
Leave the constructors public. Make the DESTRUCTOR private. Provide an
inline member function ...
void destroy() { delete this; }
Users have to call destroy instead of delete, but they won't be able to
create automatic, static or extern objects of the class.