+ 4
How you define getters and setters in C++?
Check out my code at https://code.sololearn.com/cIu2JhDB5Pbx/?ref=app Share in your view.
2 Answers
0
int getVal() const
{
return mVal;
}
void setVal (int val)
{
mVal = val;
}
0
I think using this-> is not necessary in your code as you are not storing your variables on heap but on stack.