How do access modifiers actually help programmers?

  softwareengineering

So a ‘fundamental’ OOP principle is being able to control the access to various methods and fields from other parts of the program by making them public or private. The reason is so that you cannot access an internal item or something.

But why would you not want to be able to access an internal property? And if they absolutely should not be accessed, why can programmers not just know not to do it, instead of needing to explicitly define these in the language?

LEAVE A COMMENT