标题:偶是初学者,友元怎么实现不了了
取消只看楼主
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



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-42819-1-1.html




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

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