Pure virtual destructor in interface

Posted by ALOR on Stack Overflow See other posts from Stack Overflow or by ALOR
Published on 2010-06-15T02:55:36Z Indexed on 2010/06/15 3:02 UTC
Read the original article Hit count: 200

Filed under:
|

Hello all.

Here is my problem. I'm making C++ dll, which extensively relies on instance object exports. So i return my actual instances as a pointers to interface through some exported factory method.

Interfaces i use are purely virtual, to avoid linking problame. So i need a pure virtual destructor too, and i implemented one (with empty body, as i googled it). All compiles perfectly well, except... I can't see, if the actual destructors are called or not - because when i added some

std::cout << "hello destructor";
i never get to see it.

I have some explicit "delete obj", that's not the problem.

Am i missing something? Is there another way to delete my object through interface?

© Stack Overflow or respective owner

Related posts about c++

Related posts about destructor