Answer the following questions: Y (yes) or N (No) Fruit fruit = new GoldenDelici
ID: 3796078 • Letter: A
Question
Answer the following questions: Y (yes) or N (No) Fruit fruit = new GoldenDelicious(); Orange orange = new Orange(); Is fruit instance of Apple? Is fruit instance of Orange? Is fruit instance of Macintosh? Is orange instance of Fruit? Is orange instance of Apple? Suppose the method make Apple Cider is defined in the Apple Can fruit invoke this method? Suppose the method make Orange Juice is defined in the Orange Can orange invoke this method? Can fruit invoke this method? Is the statement Orange p = new Apple () Legal? Is the statement Macintosh p = new Apple () Legal? Is the statement Apple p = new Macintosh () legal?Explanation / Answer
1-No fruit is the parent class so it is not an instance of apple
2- NO fruit is the parent class so it is not an instance of orange
3-no
4-no
5-no
6-yes parent class can invoke base class methods.
7-yes orange can invoke makeorangejuice as it is of the orange class and fruit class can alse invoke base class method.
8-no
9-no because macnitosh is the child class of apple.
10- yes as macnitosh is the derived class of base class apple and base class can create instance of derived class .
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.