//=================================== //ex0802.cpp //使用 Cat类 //=================================== #include<iostream> //----------------------------------- class Cat{ int itsAge; public: int getAge(); void setAge(int age); void meow(); //喵喵叫 };//--------------------------------- int Cat::getAge(){ return itsAge; } void Cat::setAge(int age) { itsAge=age; } void Cat::meow() { std: :cout<<”Meow.\n”; } //----------------------------------- int main(){ Cat frisky; frisky.setAge(5) ; frisky.meow(); std::cout<<”frisky is a cat who is ”<<frisky.getAge()<<” years old.\n"; frisky.meow(); }//==================================