mercredi 9 août 2017

how to use get() in input member function

I've been trying to implement an input member function for a Date class.Here's what I have:

std::istream& Date::read(std::istream& istr) {
istr.get(year_,5);
}

I want to extract 4 characters from input and save it in my parameter year_ for my Date class, but I got an error for the istr.get, I wonder why istr.get does not work while cin.get works.

Aucun commentaire:

Enregistrer un commentaire