Explicit destructor calls from inside base class destructor

A

Alf P. Steinbach

* frs:
but I was was indeed looking for avoidance of virtual functions at all.

Re-design so that you avoid polymorphic delete; that's _all_ you need to do,
and you need to do that anyway if you don't have any virtual functions.

Forget about taking control. You don't need more detailed control. You need
instead to understand that the built-in mechanism in C++ is just about the
only one that makes sense, and that the goal is therefore to work with the
langauge so as to use that built-in mechanism, not to replace it (which will
be less efficient) or "improve" it (which will be incorrect and possibly UB).

Having said that, however, it may be that you need a few ideas for the
re-design. And one such idea that I think you'll benefit from is the
flyweight pattern. It tackles the problem of having many small objects.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,534
Members
45,008
Latest member
Rahul737

Latest Threads

Top