Write a program with a class animal. Inside it define a name and an age variables, and set_value() function. Then create two bases variables Zebra and Dolphin which write a message telling the age, the name and giving some extra information (e.g. place of origin).
输入
Zebra
3
Afican
Dolphin
5
swimming
输出
Zebra
3
Afican
Dolphin
5
swimming
The main function is provided, you only need to complete the Animal Class:
int main(){
int age;
string name, extra;
cin>>name>>age>>extra;
Animal animal(name,age,extra);
cout<<animal.showName()<<endl;
cout<<animal.showAge()<<endl;
cout<<animal.showExtra()<<endl;
cin>>name>>age>>extra;
animal.setAge(age);
animal.setName(name);
animal.setExtra(extra);
cout<<animal.showName()<<endl;
cout<<animal.showAge()<<endl;
cout<<animal.showExtra()<<endl;
}