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