在主题中,我需要使用指针的运算符,所以我不必调用*a>*b
but a>b
。例如,我的操作员<<
使用指针 ok:
friend ostream& operator<< (ostream &wyjscie, Para const* ex){
wyjscie << "(" << ex->wrt << ", " << ex->liczbaWystapien <<")"<< endl;
return wyjscie;
}
但这给了我一个错误:
friend bool operator> (Para const *p1, Para const *p2){
return p1->wrt > p2->wrt;
}
Error 1 error C2803: 'operator >' must have at least one formal parameter of class type