E:\vc\Cpp1.cpp(51) : error C2064: term does not evaluate to a function不知道是什么意思
#include<iostream>#include<cmath>
using namespace std;
class shape
{
public:
virtual void printArea()=0;
};
class circle:public shape
{
public:
circle(float R)
{
r=R;};
void printArea();
private:
float r;
};
void circle::printArea()
{
cout<<3.14*r*r<<endl;
};
class rectangle:public shape
{
public:
rectangle(float x,float y)
{
a=x;b=y;
};
void printArea();
private:
float a,b;
};
void rectangle::printArea()
{
cout<<a*b<<endl;
};
class triangle:public shape
{
public:
triangle(float x,float y,float z)
{
a=x;b=y;c=z;
};
void printArea();
private:
float a,b,c;
};
void triangle::printArea()
{
cout<<0.25*sqrt(a*a(2*b*b+2*c*c-a*a)-(b*b-c*c)(b*b-c*c))<<endl;
};
void fun(shape *p)
{
p->printArea();
};
int main()
{
circle c(2);
rectangle rec(4,3);
triangle tri(3,4,5);
fun(&c);
fun(&rec);
fun(&tri);
return 0;
}
E:\vc\Cpp1.cpp(51) : error C2064: term does not evaluate to a function
请问一下哪里错了呢