I have the following exercise:
Add code to make it run properly.
class MyInt { public: private: int* MyValue; } int main(int argc,char** a
Another way:
MyInt(int x) : MyValue(new int(x)) {}
This doesn't require the additional member. However, you have to make sure that you deallocate the memory in the destructor.
~MyInt() { delete MyValue; }