嘿,我重载了 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;
}