#include<iostream>
using namespace std;
class Mouse{
private:
char *name;
double weight;
public:
Mouse(char *name, double weight) {
this->name = name;
this->weight = weight;
}
char *getName() {
return name;
}
void setName(char *name) {
this->name = name;
}
double getWeight() {
return weight;
}
void setWeight(double weight) {
this->weight = weight;
}
void eat(){
cout<<"mouse like to eat rice"<<endl;
}
};
class Cat{
private:
char *name;
double weight;
public:
Cat(char *name, double weight) {
this->name = name;
this->weight = weight;
}
char *getName() {
return name;
}
void setName(char *name) {
this->name = name;
}
double getWeight() {
return weight;
}
void setWeight(double weight) {
this->weight = weight;
}
void eat(){
cout<<"cat like to eat food"<<endl;
}
void eat(Mouse mouse){
cout<<"cat like to eat mouse,its name:"<<mouse.getName()<<endl;
}
void caught(Mouse mouse){
cout<<"cat have caught a mouse,its name:"<<mouse.getName()<<endl;
}
};
int main(){
Cat cat("Tom",20);
Mouse mouse("Jerry",10);
mouse.eat();
cat.eat();
cat.caught(mouse);
cout<<"how will "<<cat.getName()<<" deal with the mouse :"<<mouse.getName()<<"?"<<endl;
cat.eat(mouse);
}