About Question enthuware.ocajp.i.v8.2.1222 :
Moderator: admin
-
- Posts: 1
- Joined: Wed Feb 15, 2017 6:33 pm
- Contact:
About Question enthuware.ocajp.i.v8.2.1222 :
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.
-
- Site Admin
- Posts: 10078
- Joined: Fri Sep 10, 2010 9:26 pm
- Contact:
Re: About Question enthuware.ocajp.i.v8.2.1222 :
"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.
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.
If you like our products and services, please help us by posting your review here.
-
- Posts: 30
- Joined: Sun Feb 18, 2024 7:21 pm
- Contact:
Who is online
Users browsing this forum: No registered users and 18 guests