Just trying to clarify the difference between overloaded & overridden methods... Consider the scenario below;
Say I have a class, let's say 'class Master'. Suppose I have sub class, 'class Apprentice', such that the two classes are related by inheritance.
public class Apprentice extends Master
Hypothetically considering that the master class contains 2 void methods each named attack, one takes a Single string argument, the other a String and an Int argument.
public class Master{
void attack(String bodyPart){
//code for attacking
}
void attack(String bodyPart, int Damage){
//code for specific attack
}
If the Apprentice class has 2 methods named the exact same which takes exactly similar arguments, would the attack Method defined in the Master class be overloaded or overridden?
Wouldn't it be both overridden and overloaded!?