I need to overload a method with two differents return types, and in java is not possible, so does it make sense if i have a super class with "Object" return type an then i override this method in two different classes?
class A{
Object method()
{
...
}
}
class B extends A{
@override
Integer method()
{
...
}
}
class C extends A{
@override
Double method()
{
...
}
}
or is there a better way to do this? or simply other solutions?
Aucun commentaire:
Enregistrer un commentaire