Category : accessor

//inside the class NutritionData, declaration double getCaloriesPerServing() const; //Outside the class Nutrition Data, definition double NutritionData::getCaloriesPerServing() const { calPerServing = calFromCarb+calFromFat+calFromProtein; return calPerServing; } Error: says the expression calPerServing must be a modifiable lvalue. Instructor directions: 1.Add a const member function named getCaloriesPerServing that returns the total calories from carb, protein and fat. Again, don’t ..

Read more