I can't understand | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
2 Answers
+ 11
/*since we know that private instance members are not accessible outside the class , but setters & getters are available inside the class [so they can access them] ... so to access them from outside of class , we make a call to getter or setter from outside of class*/ //for more understanding see Hatsy's answer & then Martin's answer https://www.sololearn.com/Discuss/1139538/?ref=app
18th Mar 2018, 4:22 AM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 3
What cannot you understand ??? Setter methods are used to assign/change values of member variables. Getter methods are used to get that value.
18th Mar 2018, 3:41 AM
cHiRaG GhOsH
cHiRaG GhOsH - avatar