#include<iostream>
class mammal
{public:
mammal():itsage(1){cout<<"mammal constructor....."<<endl;}
virtual ~mammal(){cout<<"mammal destructor...."<<endl;}
mammal(const mammal & rhs);
virtual void speak()const{cout<<"mammal speak!";}
virtual mammal * clone(){return new mammal(*this);}
int getage()const{return itsage;}
protected:
int itsage;
};
mammal::mammal(const mammal & rhs):itsage(rhs.getage()){cout<<"mammal copy constructor..."<<endl;}
int main()
{mammal * thearray[numanimaltype];//这一行老是报错,,我实在不知为何.
return 0;
}
在线等,谢谢!!!