vendredi 1 avril 2016

How can I make an object of class having private fields and constructor using reflection?

Let's say I have the following class

 class Person
 {
     private double salary;
     private Foo(double x, double y)
     {
         salary = x;
     }         
 }

How would I create an instance of a class Person from outside and access its salary field using reflection?





Aucun commentaire:

Enregistrer un commentaire