Since c1 is declared of type C1, an objectOfA of class A, cannot be assigned to c1 because A is not a C1. A C1 is an A. So A a = objectOfC1; would have been valid.
About Question enthuware.ocajp.i.v8.2.1168 :
Moderator: admin
- 
				MarcATC
 - Posts: 3
 - Joined: Wed Oct 10, 2018 4:57 am
 - Contact:
 
About Question enthuware.ocajp.i.v8.2.1168 :
small typo in the explanation of the fourth option ? It should be:
			
			
									
									
						- 
				admin
 - Site Admin
 - Posts: 10443
 - Joined: Fri Sep 10, 2010 9:26 pm
 - Contact:
 
Re: About Question enthuware.ocajp.i.v8.2.1168 :
Actually, the text in the explanation is correct but the text in the problem statement is imprecise. Problem statement should say, 
			
			
									
									
						I have also updated the explanation as follows to make it clear:Assume that objectOfA, objectOfC1, etc. are references to objects of classes A, C1, and other classes respectively.
Since c1 is declared of type C1, an object of class A (which is what the reference objectOfA is pointing to, as given in the problem statement), cannot be assigned to c1 because A is not a C1. A C1 is an A. Therefore, A a = objectOfC1; would have been valid.
- 
				MarcATC
 - Posts: 3
 - Joined: Wed Oct 10, 2018 4:57 am
 - Contact:
 
Re: About Question enthuware.ocajp.i.v8.2.1168 :
You're absolutely right...the devil is in the details 
			
			
									
									
						Who is online
Users browsing this forum: Merlewaigo and 32 guests