Suppose that we have 2 classes A,B:
class A extends SomeClass {
public String getProp() {
return "propA";
}
}
class B extends SomeOtherClass{
private String propB;
public B setProp(String value) {
propB = value;
return this;
}
public String getProp() {
return propB;
}
}
and suppose that we have another class called X and this class X has a method someMethod that takes a reference to any of these classes ,is there a way that we can use generics in this method to call getProp() according to the object that has been passed?
Well this can be considered an answer , but I don’t like it..
}