mardi 17 novembre 2015

Overriding method within a Stranded Environment

So let's say I have class A with the method "foo" which returns the int "1":

public class A{
      public int foo(){
           return 1;
      }
}

Then I make class B to override A#foo to instead return the int "2":

public class B extends A{
      @Override
      public int foo(){
            return 2;
      }
}

But the problem is, Class A is from a external source, which every update changes the package name. I can get away with that using reflection, but that only works with Methods and Constructors. How will I be able to override A#foo without breaking it every Class A's update?





Aucun commentaire:

Enregistrer un commentaire