You are asked to develop a program for a shopping application, and you are given the following information:
Which definition of the Toy class adds a valid layer of abstraction to the class hierarchy?
public abstract class Toy { public abstract int calculatePrice(Toy t); public void printToy(Toy t) { /* code goes here */ } }
public abstract class Toy { public int calculatePrice(Toy t); public void printToy(Toy t); }
public abstract class Toy { public int calculatePrice(Toy t); public final void printToy(Toy t) { /* code goes here */ } }
public abstract class Toy { public abstract int calculatePrice(Toy t){ /* code goes here */ } public abstract void printToy(Toy t) { /* code goes here */ } }