Do the access modifiers of classes, properties or methods in C#, Java and other programming languages actually have an impact on the security of an application? Do they also protect against unauthorized access in some way? Or are they just a tool for clear and propper programming?
No, access modifiers don't offer security protection. They are merely there for developer convenience, e.g. they help to enforce good coding practices and help with programming patterns.
It's easy to access otherwise inaccessible modifiers by using reflection in Java/C# and other languages.
The main purpose of the access modifiers is to enforce a specific design, not any kind of security.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With