访问修饰符的安全影响(公共,私有,内部,受保护) [英] Security impact of access modifiers (public, private, internal, protected)
问题描述
实际使用C#,Java和其他编程语言中的类,属性或方法的访问修饰符对应用程序的安全性有影响吗?他们是否也以某种方式防止未经授权的访问?或者它们只是清晰和适当编程的工具?
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.
通过使用Java / C#和其他语言中的反射,可以轻松访问其他无法访问的修饰符。
It's easy to access otherwise inaccessible modifiers by using reflection in Java/C# and other languages.
这篇关于访问修饰符的安全影响(公共,私有,内部,受保护)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!