Access Modifiers - what's the purpose?
I'm relatively new to programming in general and I was wondering if anyone could help me understand the purpose of access modifiers? I understand the fact that they set different levels of access for classes and variables etc. but why would you want to limit what has access to these? What is the point in not allowing access for different things? why not just allow access for everything? Sorry if this is a stupid question! There are thousands of reasons, but I'll quote a few from here and then expand on those: Hiding the internals of the object protects its integrity by preventing users from