Which definition of the Toy class adds a valid layer of abstraction to the class hierarchy?

You are asked to develop a program for a shopping application, and you are given the
following information: The application must contain the classes Toy, EduToy, and consToy.
The Toy class is the superclass of the other two classes. The int caicuiatePrice (Toy t)
method calculates the price of a toy. The void printToy (Toy t) method prints the details of a
toy. Which definition of the Toy class adds a valid layer of abstraction to the class
hierarchy?

You are asked to develop a program for a shopping application, and you are given the
following information: The application must contain the classes Toy, EduToy, and consToy.
The Toy class is the superclass of the other two classes. The int caicuiatePrice (Toy t)
method calculates the price of a toy. The void printToy (Toy t) method prints the details of a
toy. Which definition of the Toy class adds a valid layer of abstraction to the class
hierarchy?

A.
Option A

B.
Option B

C.
Option C

D.
Option D

Explanation:



Leave a Reply 6

Your email address will not be published. Required fields are marked *


Kaykay

Kaykay

Definitely A – Option A.

Tomas

Tomas

Answer: A (option A)

Tushar

Tushar

Correct answer is B. Since super class does not know the details of the sub-class so it can’t print the details.