I have created _year,_day,_date as private integers in class Date.
error: `_year' is not a type and similar for day and mon in write()
error: ambiguous overload for 'operator>>' in 'istr >> ((const oop244::Date*)this)->oop244::Date::_year'
note: candidates are: std::basic_istream<_CharT, _Traits>& std::basic_istream<_CharT, _Traits>::operator>>(std::basic_istream<_CharT, _Traits>&(*)(std::basic_istream<_CharT, _Traits>&)) [with _CharT = char, _Traits = std::char_traits]
std::ostream& Date::write(std::ostream& ostr) const
{
int year,mon,day;
return ostr<<year<< "/" <<mon<< "/" <<day;
this._year=year;
this._mon=mon;
this._day=day;
}
//overloading istream for object Date input
std::istream& Date::read(std::istream& istr)const
{
char c;
istr>>_year>>c>>_mon>>c>>_day;// char c for '/'
if(istr.fail())
_readErrorCode=1;
this->validate();
return istr;
}
//overloading << operator
std::ostream &operator<<(std::ostream& ostr,Date &d)
{
return d->write(ostr);
}
//overloading >> operator
std::istream& operator>>(Date &d,std::istream& istr)
{
return d->read(istr);
}
}. And unless you have the oddestoperator->overload inclass Date, thosed->should bed.. Perhaps post the real code? - WhozCraig