I have one base class and two child classes.
public class A {
........
........
void func() {
......
......
}
}
public class B extends A {
........
........
@Override
void func() {
super.func();
// other stuff
}
}
public class C extends A {
........
........
@Override
void func() {
super.func();
// other stuff
}
}
Now, when I am calling like this:
A b = new B();
b.func();
A c = new C();
c.func();
Now super.func()
is the overlapping portion and get called two times. What's the best practices to avoid this overlapping call? How the design is supposed to be?
Aucun commentaire:
Enregistrer un commentaire