+ 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.

4th Apr 2017, 6:08 AM
देवेंद्र महाजन (Devender)
देवेंद्र महाजन (Devender) - avatar
2 Respostas
0
int getVal() const { return mVal; } void setVal (int val) { mVal = val; }
4th Apr 2017, 9:57 PM
soman
0
I think using this-> is not necessary in your code as you are not storing your variables on heap but on stack.
28th Jun 2018, 1:12 PM
k kasayab
k kasayab - avatar