Page 1 of 1

About Question enthuware.ocajp.i.v8.2.1222 :

Posted: Sun Feb 19, 2017 6:38 am
by olaska
I have a problem to understand answer:" You cannot access class A's m1() from class C for the same object ( i.e. this)". Sorry, but english is not my native language and few times i got confused what you are asking for and what answer should be correct. Could you clarify this answer more detailed. First part is ok - it is not possible to access method m1() defined in class A - but what about object - if I declare reference type A - I should have an access to this method.

Re: About Question enthuware.ocajp.i.v8.2.1222 :

Posted: Sun Feb 19, 2017 12:03 pm
by admin
"this" is a reference variable that points to the current instance of the same class in which it is used. For example, if you use this in class C's instance method, then "this" will refer to the same instance of class C.

In this option, it is asking you whether you can access A's m1 from C class's code using "this" reference. It is not possible.

Re: About Question enthuware.ocajp.i.v8.2.1222 :

Posted: Sun Mar 17, 2024 12:25 pm
by likejudo