| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 2573 人关注过本帖
标题:D:\NO2\point.cpp(20) : error C2084: function 'double __thiscall Point: ...
取消只看楼主 加入收藏
karlzhouzhi
Rank: 1
等 级:新手上路
帖 子:70
专家分:0
注 册:2005-12-25
收藏
 问题点数:0 回复次数:0 
D:\NO2\point.cpp(20) : error C2084: function 'double __thiscall Point::ang

我的class定义:#include<iostream.h>
#include<math.h>

class Point
{
public:
void Set(double ix,double iy);
double xoffset();
double yoffset();
double angle();
double radius();
protected:
double x;
double y;
};

成员函数定义:#include<iostream.h>
#include"point.h"
void Point::Set(double ix,double iy)
{
x=ix;
y=iy;
}

double Point::xoffset()
{
return x;
}

double Point::yoffset()
{
return y;
}

double Point::angle()
{
return(180/3.14159)*atan2(y,x);
}

double Point::radius()
{
return sqrt(x*x+y*y);
}
主函数:
#include<iostream.h>
#include"point.h"

void main()
{
Point p;
double x,y;
for(;;)
{
cout<<"Enter x and y:"<<endl;
cin>>x>>y;
if(x<0)
break;
p.Set(x,y);
cout<<"angle="<<p.angle()
<<",radius="<<p.radius()
<<",x offset="<<p.xoffset()
<<",y offset="<<p.yoffset()<<endl;
}
}
compile没问题
build后就出现问题了:D:\NO2\point.cpp(4) : error C2084: function 'void __thiscall Point::Set(double,double)' already has a body
D:\NO2\point.cpp(10) : error C2084: function 'double __thiscall Point::xoffset(void)' already has a body
D:\NO2\point.cpp(15) : error C2084: function 'double __thiscall Point::yoffset(void)' already has a body
D:\NO2\point.cpp(20) : error C2084: function 'double __thiscall Point::angle(void)' already has a body
D:\NO2\point.cpp(25) : error C2084: function 'double __thiscall Point::radius(void)' already has a body
Error executing cl.exe.

搜索更多相关主题的帖子: cpp ang double Point point 
2006-01-16 12:21
快速回复:D:\NO2\point.cpp(20) : error C2084: function 'double __thiscall P ...
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.016677 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved