Joshua Joshua - 1 year ago 131
C++ Question

How to overload a destructor?

How do I overload a destructor?

Answer Source

You can't. There is only one destructor per class in C++.

What you can do is make a private destructor and then have several public methods which call the destructor in new and interesting ways.

class Foo {
  ~Foo() { ... }
  DestroyFoo(int) { ... };
  DestroyFoo(std::string) { ... }
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download