public interface I {
int a();
int b();
}
public class IR implements I {
@Override
public int a() {
return 1;
}
@Override
public int b() {
return 2;
}
}
public class A implements I {
Delegat IR = new IR();
@Override
public int a() {
return delegat.a();
}
@Override
public int b() {
return delegat.b();
}
}
public class B extends IR {
}
class B implements I {
Delegat IR = new IR();
implements I by the delegate;
}
Find more questions by tags Patterns of designingOOPProgramming languages