Novice Java programmer here...
So I have this superclass:
public abstract class Animal
{
public abstract String attack(Animal entity);
}
and then I have this subclass:
public class Dog extends Animal
{
protected int something;
public int getSomething()
{
return something;
}
@Override
public String attack(Animal entity)
{
entity.getSomething();
//THIS RIGHT HERE
}
I'm not asking why this isn't working as much as I'm asking how I would go about accessing those methods and instances within that subclass. Should I create a new instance of Dog within the attack method and assign entity to the newly created instance? What is the "right" way to go about accomplishing this?