Re:Ask HN: Why do you make class members private?
by dragonwriter on Monday July 25, 2022 @02:28PM
(#32228789)
A class always has an API and an internal implementation. Sometimes, it is necessary to split some of that implementation up (for, e.g., code reuse) into methods or properties that have no purpose in the API, and making those methods/properties private prevents them from becoming accidental parts of the API.
This applies to classes without external users, too, the same divisions between class responsibilities and implementation remains valod
This applies to classes without external users, too, the same divisions between class responsibilities and implementation remains valod