I want to inherit specific instances from a superclass, not all of them.
For example:
public class Snake extends Reptile {
private boolean hasLegs = false;
public Snake(double[] legLength, double tailLength, String color, boolean hasScales, boolean hasLegs) {
super(legLength, tailLength, color, hasScales);
this.hasLegs = hasLegs;
}
I want to inherit all instance variables from the class Reptile except double[] legLength(as snakes doesn't have legs).
How can I do that without changing code in the Reptile class?
Thanks.