interface IA {
public void a();
}
class AB implements IA {
@Override
public void a() { System.out.println("a"); } // <---.
public void b() { System.out.println("b"); }
}
class C {
public void c() { System.out.println("c"); }
}
// My class:
class AC extends C implements IA {
@Override
public void a() { System.out.println("a"); } // duplicate code
}
public class Main {
public static void main(String[] args) {
AC ac = new AC();
ac.a(); // "a"
ac.c(); // "c"
}
}
Using duplicate code does not seem to be a good idea, how could I design my class properly?