I have a C/C++ book. I am doing windows programming along with console. I just had a question. What are class constructors and destructors for. I saw this example before:
class Cat
{
public:
Cat(int initialAge); // Constructor
~Cat(); // Destructor
int getage();
void SetAge(int age);
private:
int itsage;
};
// Sets up functions in class "Cat"
... // Some Code
int main()
{
Cat Frisky(5);
Frisky.Meow();
... // More code
}
What are they used for?