How do you Specify a Method to be a Destructor Rather than a Constructor in C++?
c++, class, constructor, destructor
Solution
Here's an example:
MyClass::MyClass() // Constructor
MyClass::~MyClass() // Destructor
Note the "~" in front of the destructor.
Problem
How do you specify a method to be a destructor rather than a constructor in C++? This confuses me very much. I can't tell the difference between the two.