I’m currently trying to write some classes and I come accross the following problem:
I’m trying to write a class that implements some functionality from two interfaces
interface IA {
public void doSomething();
}
interface IB {
public void doSomethingToo();
}
And I have two classes implementing those interfaces:
class FooA implements IA, IB{
}
class FooB implements IA, IB{
}
Is there I way I can do this:
public <type> thisClassImGonnaUse = returnEitherFooAOrFooB();
thisClassImGonnaUse.doSomething();
thisClassImGonnaUse.doSomethingToo();
Do a new interface
and make FooA and FooB implement it instead.