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

arrow
arrow
    全站熱搜

    讓地獄深紅的天亮 發表在 痞客邦 留言(0) 人氣()