I have implemented Template Method, and i faced with this situation:
public class ProductTemplate() {
protected Item getItemFromShop(){
processItemPrice();
callOrderSummary();
}
protected void processItemPrice() {
Do some logic....
}
protected void callOrderSummary()
Do some logic....
}
}
public class ImportedProduct extends ProductTemplate() {
@Override
protected Item getItemFromShop() {
super.getItemFromShop(); // When i call this super method, they will use the processItemPrice() from the implementation
}
@Override
protected void processItemPrice() {
Do another logic....
}
}
My doubt is.. can in call an super method and if inside this super method there is a method call and i have this method overridden, what method implementation the class will use?
Aucun commentaire:
Enregistrer un commentaire