#include <iostream>
class Cat
{
public:
Cat(int initialage);//构造
~Cat();//解析
int GetAge();
void SetAge(int age);
void Meow();
private:
int itsAge;
};
Cat::Cat(int initialage) //constructor of Cat.
{
itsAge = initialage;
}
Cat::~Cat()
{
}
int Cat::GetAge()
{
return itsAge;
}
void Cat::SetAge(int age)
{
itsAge = age;
}
void Cat::Meow ()
{
}
int main()
{
Cat Frisky(5);
Frisky.Meow();
std::cout << " Frisky is a cat" << Frisky.GetAge() << " years old /n";
Frisky.Meow();
Frisky.SetAge(7);
std::cout << " now SetAge to 7 ,the cat Frisky is " << Frisky.GetAge() << " years old /n";
return 0;
}