作者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