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.
views:
201answers:
2
+12
A:
Here's an example:
MyClass::MyClass() // Constructor
MyClass::~MyClass() // Destructor
Note the "~" in front of the destructor.
Soo Wei Tan
2009-07-03 00:05:45
~ is the not operator (logical), funny C++ designers
CrazyJugglerDrummer
2009-07-03 00:40:20
Nitpick: ~ is the *bitwise* not operator, not the *logical* not operator.
j_random_hacker
2009-07-03 05:01:01