Hello,
could anyone at first sight tell me about why this below doens't work with keyword "const" (that I guess the right way) and it works without it? thanks
friend std::ostream& operator<<(std::ostream& os, const Apple& a) { // <- "const"
return os << "kind = " << a.getKind().c_str() << "\t"
<< "weight = " << a.getWeight() << "\t" << "status = " << a.getStatus().c_str() << endl;
}
friend std::ostream& operator<<(std::ostream& os, const Apple& a) { // <- "const"
return os << "kind = " << a.getKind().c_str() << "\t"
<< "weight = " << a.getWeight() << "\t" << "status = " << a.getStatus().c_str() << endl;
}
To copy to clipboard, switch view to plain text mode
Bookmarks