![]() |
#2
寒风中的细雨2012-04-16 15:50
|

#include<iostream>
using namespace std;
class space
{
int x;
int y;
int z;
public:
space()
{
x=1;
y=1;
z=1;
}
friend void operator-(space &s)//编译时提示这儿有错
{
s.x=-s.x;
s.y=-s.y;
s.z=-s.z;
}
void dispaly()
{
cout<<x<<y<<z<<endl;
}
};
int main()
{
space p;
-p;
p.dispaly ();
return 0;
}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
using namespace std;
class space
{
int x;
int y;
int z;
public:
space()
{
x=1;
y=1;
z=1;
}
friend void operator-(space &s)//编译时提示这儿有错
{
s.x=-s.x;
s.y=-s.y;
s.z=-s.z;
}
void dispaly()
{
cout<<x<<y<<z<<endl;
}
};
int main()
{
space p;
-p;
p.dispaly ();
return 0;
}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
我是照书上的写的,只想验证下。结果。。。
请各位帮忙解释下!