| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 788 人关注过本帖
标题:偶是初学者,友元怎么实现不了了
取消只看楼主 加入收藏
hao0717
Rank: 1
等 级:新手上路
帖 子:2
专家分:0
注 册:2006-1-13
收藏
 问题点数:0 回复次数:0 
偶是初学者,友元怎么实现不了了
这个程序
#include <iostream>
using namespace std;
//-------------------
class Point{
int x,y;
public:
Point(int a,int b):x(a),y(b){}
void print()const{cout<<"("<<x<<","<<y<<")\n";}
friend Point operator+(const Point& a,const Point& b);
};
//-------------------------
Point operator+(const Point& a,const Point& b){
Point s(a.x+b.x,a.y+b.y);
return s;
}
//---------------------------
void main(){
Point a(2,3);
Point b(4,7);
(a+b).print();
}

我编译怎么老出错,报错:fatal error C1001: INTERNAL COMPILER ERROR
(compiler file 'msc1.cpp', line 1786)
Please choose the Technical Support command on the Visual C++
Help menu, or open the Technical Support help file for more information

我照书编也有错误,WHY?
难道编译器也有错误?为什么???求救啊
搜索更多相关主题的帖子: Point const operator 
2006-01-13 21:35
快速回复:偶是初学者,友元怎么实现不了了
数据加载中...
 
   



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

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