I don't see any problem with dispose() method (except that it doesn't nullifies 
the pointer, which can be a performance issue for some GC implementations). If 
you plan to go C# way, it's reasonable to adopt its techniques of destruction. 
Moreover C# and C++ approaches are compatible. If the programmer doesn't 
guarantee ownership of the object, it's just unreasonable to call delete, here 
adding the dispose() method to the Object and using it for destruction will 
help.

Your proposal is indeed better than the scheme above and it's not a pain to 
implement and use destruct+free function, but delete and dispose are already 
well-known idioms, as you were already told about.

Reply via email to