DavidTheLazyStudent
Technical User
Each time I try to add overloaded input/output I get a compiler message about accessing the class's private data. If I REM out the statments it functions as expected.
My Friend statment is:
friend ostream& operator << (ostream &out, Meal &aMeal);
With Meal being the Class, aMeal is representing an Object of the Class. I believe this is my problem but can not find any solutions in my books. Is aMeal suspose to be only the object name and not just anything I use for refferencing inside my function?
*ostream& operator << (ostream &out, Meal &aMeal)
{
out << aMeal.entree << '\t' << aMeal.calorie << '\n';
return(out);
}
I have the exact same problem on the input.
My Friend statment is:
friend ostream& operator << (ostream &out, Meal &aMeal);
With Meal being the Class, aMeal is representing an Object of the Class. I believe this is my problem but can not find any solutions in my books. Is aMeal suspose to be only the object name and not just anything I use for refferencing inside my function?
*ostream& operator << (ostream &out, Meal &aMeal)
{
out << aMeal.entree << '\t' << aMeal.calorie << '\n';
return(out);
}
I have the exact same problem on the input.