Page 1 of 1
					
				Re: About Question enthuware.ocajp.i.v7.2.1015 :
				Posted: Wed Sep 26, 2012 4:53 pm
				by Enrique
				Then if it comment line //3, only show 10 and 40. ?
King regards
			 
			
					
				Re: About Question enthuware.ocajp.i.v7.2.1015 :
				Posted: Wed Sep 26, 2012 5:37 pm
				by admin
				Enrique wrote:Then if it comment line //3, only show 10 and 40. ?
King regards
If you comment only line //3, it will not compile.
HTH,
Paul.
 
			 
			
					
				Re: About Question enthuware.ocajp.i.v7.2.1015 :
				Posted: Sun Jul 07, 2013 10:05 am
				by Loerti
				Very good question. 
But i believe it's called hiding. I.e.  B.i hides A.i. So A.i not inherited by B and therefore not inherited by C. 
Best regards
Max
			 
			
					
				Re: About Question enthuware.ocajp.i.v7.2.1015 :
				Posted: Sun Dec 28, 2014 1:17 am
				by coder007
				Loerti wrote:
But i believe it's called hiding. 
Hiding or shadowing, both are correct.
 
			 
			
					
				Re: About Question enthuware.ocajp.i.v7.2.1015 :
				Posted: Sun Mar 01, 2015 5:43 pm
				by dmcinnis1
				After reading all of the comments I still don't understand why c can't directly access i in A.  If c doesn't inherit i from B because it's private, then why can't c inherit and directly access i in A; i.e., c.i?
			 
			
					
				Re: About Question enthuware.ocajp.i.v7.2.1015 :
				Posted: Sun Mar 01, 2015 5:48 pm
				by admin
				That is just how the language is designed. You can access A's i but you have to do ( (A)c).i
HTH,
Paul.
			 
			
					
				Re: About Question enthuware.ocajp.i.v7.2.1015 :
				Posted: Sun Mar 01, 2015 5:49 pm
				by admin
				Loerti wrote:Very good question. 
But i believe it's called hiding. I.e.  B.i hides A.i. So A.i not inherited by B and therefore not inherited by C. 
Best regards
Max
You are right. It is technically "hiding", not shadowing.
thank you for your feedback!
 
			 
			
					
				Re: About Question enthuware.ocajp.i.v7.2.1015 :
				Posted: Mon Mar 02, 2015 4:11 pm
				by __Bill
				Why will this not compile if //2 is commented out?
			 
			
					
				Re: About Question enthuware.ocajp.i.v7.2.1015 :
				Posted: Mon Mar 02, 2015 9:22 pm
				by admin
				As the explanation says, "You cannot access c.j because j is private in A."
			 
			
					
				Re: About Question enthuware.ocajp.i.v7.2.1015 :
				Posted: Tue Mar 03, 2015 12:16 am
				by __Bill
				admin wrote:As the explanation says, "You cannot access c.j because j is private in A."
//2 is c.i not c.j.      A wrong answer is " It will compile if //2 is commented. "  

  Maybe you mean UNcommented?  Pretty sure something is messed up in there.  Check it out.
 
			 
			
					
				Re: About Question enthuware.ocajp.i.v7.2.1015 :
				Posted: Tue Mar 03, 2015 12:35 am
				by admin
				No, it is correct. If you comment out //2, line marked //3 i.e. c.j will still be there and that won't compile.
			 
			
					
				Re: About Question enthuware.ocajp.i.v7.2.1015 :
				Posted: Tue Mar 03, 2015 12:49 pm
				by __Bill
				Ok, I get it.  It will compile if //2 is commented out, yet that won't fix the problem that keeps it from compiling...
If you wanted to be clearer you could change that answer to read "commenting //2 will allow it to compile."