I have a situation that looks like the following code:
#include
class A
{
public:
A() { std::cout << \"A created!\" << std::end
Is this possible in its destructor or do I have to implement a virtual Destroy() method or something like that?
Make destructor of A virtual.
virtual ~A() { std::cout << "A destroyed!" << std::endl; }
If your class have virtual methods, it should use virtual destructor. At least some compilers will complain if you aren't using virtual destructor in class with virtual methods.