主题:求助啊, 高手帮忙啊!!
求助啊, 代码是:
#include <iostream.h>
class Animal
{
public:
Animal(int height,int weight)
{
cout<<"animal construct"<<endl;
}
~Animal()
{
cout<<"animal deconstruct"<<endl;
}
void eat()
{
cout<<"animal eat"<<endl;
}
void sleep()
{
cout<<"animal sleep"<<endl;
}
virtual void breathe()
{
cout<<"animal breathe"<<endl;
}
};
class Fish : public Animal
{
public:
Fish():Animal(400,300),a(1)
{
cout<<"fish construct"<<endl;
}
~Fish()
{
cout<<"fish deconstruct"<<endl;
}
void breathe()
{
cout<<"fish bubble"<<endl;
}
private :
const int a;
};
void fn(Animal *pAn)
{
pAn->breathe();
}
void main()
{
Fish fh;
Animal *pAn;
pAn=&fh;
fh(pAn);
}
错误代码:Main.cpp(82) : error C2064: term does not evaluate to a function
高手帮忙啊!! 谢谢拉