#include<iostream>
using namespace std;
class Person
{
friend void operator-(Person);//错误箭头指在这一行
private:
int iApple;
public:
Person(int iApple);
void operator-();
void display;
};
void operator-(Person);
int main()
{
Person XiaoWang(5);
cout<<"\n调用operator-()负号符函数前"<<endl;
XiaoWang.display();
operator-(XiaoWang);
cout<<"\n调用operator-()负号运算符函数后"<<endl;
XiaoWang.display();
return 0;
}
Person::Person(int iApple)
{
this->iApple=iApple;
}
void operator-(person p1)
{pi.iApple=-iApple;
}
void person::display()
{
cout<<"iApple"<<iApple<<endl;
}
e:\project\lal.cpp(5) : 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