[Resolved] Classes and Destructors
I've never officially learned about classes, I just use them all the time but never really understand them. So a few questions:
1) What is the purpose of the desctructor? Does it just clear up memory?
2) What's wrong with this?:
Code:
class square_info {
private:
float h, w;
public:
square_info () {
h = 0;
w = 0;
}
square_info (float height, float width) {
h = height;
w = width;
}
void print() {
cout << "h: " << h << " | w: " << w << endl;
}
~square_info(); //adding this line gives linking errors?
};
Thanks in advance.