I have experienced many of the problems associated with using C++ interfaces, the destructor is a major problem. But for dynamic content I have found the following useful:
bool IsDestroyed() const;
class MyObject : public IDestructableObject
m_array = new int;
m_bDestroyed = true;
bool IsDestroyed() const
Example of implementation:
// Create some distroyable objects.
MyObject *pmyObjectA = new MyObject();
MyObject *pmyObjectB = new MyObject();
// Add objects to an array of objects for cleanup.
// Destroy all objects.
for(std::vector::iterator itObject = objects.begin(); itObject != objects.end(); ++itObject)
With all due respect I strongly advice against using such a way of turning the C++ syntax towards Java, and bringing nothing new, but giving the false impression of interfaces implementation, which are not supported by the C++ standard. It's bad for readability and even worse for code maintenance.