I'm pretty sure it's not a syntax error so if I mispelled anything thats probably not the error.
*Chapter 8 Exercise 3*
What design problem does the following program have?
#include<iostream>
using namespace std;
class Critter
{
public:
int GetHunger() const {return m_hunger;} //Is this where the error is?
private:
int m_hunger;
};
int main()
{
Critter crit;
cout<<crit.GetHunger() <<endl;
return 0;
}
By the way is there a book with the answers or something?? I find it odd that he gives us exercises and we can't tell if we are right or not.


Sign In
Create Account

Back to top









