Hi
The explanation for this question indicates that an explicit cast is required for both answers. While I can understand the downcast required to assign o to r, I don't think b requires it to be explicit (though it does no harm). As b is a subclass of a and inherits all its interfaces, we should be able to upcast b to r implicitly?
Thanks
About Question enthuware.ocajp.i.v7.2.983 :
Moderators: Site Manager, fjwalraven
-
- Posts: 32
- Joined: Wed Aug 28, 2013 6:12 am
- Contact:
-
- Site Admin
- Posts: 10388
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocajp.i.v7.2.983 :
Yes, you are right. The cast is not really required for option 5. The explanation is valid for option 2 only. This has now been fixed.
thank you for your feedback!
thank you for your feedback!
Who is online
Users browsing this forum: No registered users and 4 guests