Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

21. (15 marks] Suppose that Fruit, Apple, Orange, Golden Delicious, and McIntosh are defined in the following inheritance hierarchy: Fruit Apple Orange + makeAppleCider():void +

image text in transcribed

21. (15 marks] Suppose that Fruit, Apple, Orange, Golden Delicious, and McIntosh are defined in the following inheritance hierarchy: Fruit Apple Orange + makeAppleCider():void + makeOrange Juice(): void Golden Delicious Mcintosh And assume that the following code is given: Fruit fruit = new Golden Delicious(); Orange orange = new Orange(); Answer the following questions, and explain your answer. a. Is fruit instanceof Fruit? b. Is fruit instanceof Orange? C. is fruit instanceof Apple? d. Is fruit instanceof Golden Delicious? e. Is fruit instanceof McIntosh? f. Is orange instanceof Orange? g. Is orange instanceof Fruit? h. Is orange instanceof Apple? i. Can fruit invoke makeAppleCider method? j. Can orange invoke makeAppleCider method? k. Can fruit invoke makeOrange Juice method? I. Can orange invoke makeOrange Juice method? m. Is the statement Orange p = new Apple () legal? n. Is the statement McIntosh p = new Apple () legal? o. is the statement Apple p = new McIntosh() legal

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Transactions On Large Scale Data And Knowledge Centered Systems Xxviii Special Issue On Database And Expert Systems Applications Lncs 9940

Authors: Abdelkader Hameurlain ,Josef Kung ,Roland Wagner ,Qimin Chen

1st Edition

3662534541, 978-3662534540

More Books

Students also viewed these Databases questions