类的定义问题,高手来看下啊!
#include <iostream.h>#include <math.h>
class point
{
public:
float x,y,z;
public:
point(float a=3,float b=4,float c=5);
point(point &p);
void negate(float m,float n,float k);
void norm(double l);
void print();
};
point::point(float a,float b,float c)
{
x=a;
y=b;
z=c;
}
point:: point(point &p)
{
x=p.x;
y=p.y;
z=p.z;
}
void point::negate(float m,float n,float k)
{
m=-x;
n=-y;
k=-z;
cout<<"这个点关于远点的对称点是:";
cout<<"("<<m<<","<<n<<","<<k<<")"<<endl;
}
void point::norm(double l)
{
l=sqrt(x*x+y*y+z*z);
cout<<"这个点和原点的距离是:"<<l<<endl;
}
void point::print()
{
cout<<"这个点是:"<<"("<<x<<","<<y<<","<<z<<")"<<endl;
}
void main()
{
point t1(2,3,4);
point t2(t1);
t1.norm;
t2.print;
}
这个程序可以通过编译,没错误,但是有警告,尤其是三个成员函数,不能调用,说是函数引用什么的,麻烦高手解读下,