#include#include using namespace std;class MachinePets{public: MachinePets(const string s):nickname(s){}; string getNickname() {return nickname;}; virtual string talk()=0;private: string nickname; };class PetCats:public MachinePets{ public: PetCats(const string s):MachinePets(s){}; string talk() {return "miao wu~";}};class PetDogs:public MachinePets{ public: PetDogs(const string s):MachinePets(s){} string talk() {return "wang wang~";};};void play(MachinePets *p){ cout< getNickname()<<"says"< talk()<