Well, at least in .NET you can reject reflection using . NET
In addition, the goal of visibility levels in classes and class members is not only access security. It’s also a tool for organizing and documenting your code: when you see a private member, you know that it is not intended to be used outside the class, and perhaps you can use it with reflection, you usually won’t do it lead to unexpected behavior in your application.
In any case, I find this question similar to: "What is the purpose of doors with locks if I can break them with a large enough hammer?" :-)
source share