What is the use of private members or member functions if they can't be used outside that class | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is the use of private members or member functions if they can't be used outside that class

Classes

30th Jan 2022, 12:32 PM
Gurmeet Singh
Gurmeet Singh - avatar
3 Answers
+ 1
Important data or Gaming currencies are stored in private member's. If these things are in public, then any hacker can change them.
1st Feb 2022, 9:16 AM
Commander Erwin Smith
Commander Erwin Smith - avatar
0
That is exactly the use of private methods – that you do not use them outside of the class
30th Jan 2022, 12:45 PM
Lisa
Lisa - avatar
0
This is called (data hiding).
30th Jan 2022, 12:57 PM
Mohammed