In Java and C #, you can call a private method through reflection (as shown below).
Here is an example
public class Foo { private void say() { WriteToConsoleMethod("Hello reflected world"); } }
where WriteToConsole()depends on the language, then I can run the following to call the private method say():
WriteToConsole()
say()
FROM#
Foo f = new Foo(); var fooType = f.GetType(); var mi = fooType.GetMethod("say", BindingFlags.NonPublic | BindingFlags.Instance); mi.Invoke(f, null);
Java
Foo f = new Foo(); Method method = f.getClass().getDeclaredMethod("say", null); method.setAccessible(true); method.invoke(f, null);
As you can see, this is not obvious, but it is also not difficult.
Java .NET , . , , " ". , . - , . , , , , , ...
? . , .
? ; , .
? , , , .
/? ... , .
, .
, - , -, , .
- , (, - / ), Code Access Security .net. runtime , Authenticode.
// ++ , ++ , .
, , ; , , , IDE , , , .
, , - , . // , , , . - ( ), - , . , , , .. . .
, , , , , , , EASIER , . .
.Net Reflector, , , , private. , , , , .
Source: https://habr.com/ru/post/1718814/More articles:C ++ templates: are header files still broken? - c ++Subtract SQL Date - sqlКлассическая аутентификация ASP и ASP.Net - asp.netXSLT 1.0: заменить новый символ строки на _ - xsltConnecting OracleClient + TNSless to .NET - oracleDeploy the .NET COM Interop assembly from your hosting process - .netHow to fix inconsistent binding error in flex 3? - flexWhere can I set the current value of CurrentUICulture in Windows XP? - windowsКриптографический сбой при подписании сборки <имя_создания>.dll '-' плохая версия провайдера ' - cryptographySort with sql server and sort and unicode - sql-serverAll Articles