Problem

AbstractClasses, Upcasting, Downcasting—TheProductionHierarchyDetermine which of the follo...

AbstractClasses, Upcasting, Downcasting—TheProductionHierarchy

Determine which of the following lines generates an error. Use the Production hierarchy of this chapter. In each case, explain the cause of the error.

a. Production p = new Musical("Sweeny Todd", "Harold Prince", "Hugh Wheeler", "Stephen Sondheim", " Stephen Sondheim", 557);


b. Production p = new Production();


c. Musical m = new Film();


d. Musical m = new Musical();


e. Play p = new Musical(); p.getDirector(); (Musical) p.getComposer();


f. Film play = new Musical();


g. Production p = new Musical(); p.getDirector(); (Play) p.getDirector(); (Play) p.getComposer();


h. Comparable c = new Musical(); Film f = new Musical(); c.compareTo(f);

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
Solutions For Problems in Chapter 12
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT