SmomalaHspolf
New Member
I'm trying to achieve an overloaded interface method. I know that this does not work in Java, but how could I rewrite the following to have the implementation type in my \[code\]action()\[/code\] methods, and not the \[code\]Base\[/code\] type?\[code\]class Base;class Foo extends Base;class Bar extends Base;interface IService { void action(Base base);}class FooService implements IService { void action(Foo foo) { //executes specific foo action }}class BarService implements IService { void action(Bar bar) { //executes specific Bar action }}\[/code\]usage:\[code\]Base base; //may be foo or baranyService.action(bar);\[/code\]You get the idea. How could I do this?