0
why use "private:"?
I cant find any use for making class members private, it seems like a meaningless thing to do. Or there is a reason? Please tell me what it is
1 Answer
+ 6
* Reduces error risk of code
* Makes things easier to read (When something is private you know for a fact it is only something within the class)
So it's essentially for maintainability and understandability.
Really good analogy by the top comment here:
https://stackoverflow.com/questions/24661886/reason-for-making-class-members-private
As the guy from that link said, I always make things private (Only private) until I need to make it public or protected.