【发布时间】:2011-04-12 10:31:38
【问题描述】:
嘿,我已经覆盖了 operator<<,当我尝试在打印方法 (const) 中使用它时,我遇到了一个错误:
被覆盖的运算符:
ostream& operator <<(ostream& os, Date& toPrint)
{
return os << toPrint.GetDay() << "/" << toPrint.GetMonth() << "/" << toPrint.GetYear();
}
我想在哪里使用它:
void TreatmentHistory::TreatmentHistoryPrint() const
{
cout << m_treatmentDate << "\n" << endl;
}
【问题讨论】:
-
红线下
标签: c++ operators operator-overloading