close
此類別對fstream 只有一個重載:
friend fstream & operator << (fstream & f, const myclass& mc)
{
//.....
f << (double)(number); //這一行錯誤,isoc++認為有歧義,
//fstream & operator << (fstream & f, const myclass& mc) 跟
//內建吃double的operator << 衝到了,不知道要選哪個執行
return f;
}
結果
friend fstream & operator << (fstream & f, myclass& mc)
{
//.....
f << (double)(number);
//這一行錯誤,isoc++認為有歧義,
//fstream & operator << (fstream & f, const myclass&
mc) 跟
//內建吃double的operator <<衝到了
return f;
}
拿掉const就沒事了qq
全站熱搜