作者ricky770927 (ricky)
看板EE_DSnP
標題[問題] friend function
時間Tue Jan 1 19:52:04 2008
當我寫
class ModInt
{
friend ostream& operator << (ostream& os, const ModInt& n);
private:
int _number;
static unsigned _modulus;
};
ostream& operator<<(ostream &os, const ModInt &n )
{
os<<n._number;
return os;
}
為何他說n不能access到_number呢?
我明明有宣告friend呀?
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 218.210.43.232
1F:推 ric2k1:上面的 code compile OK 呀! What's the error message? 01/01 21:55