I have this code:
class A{
class B{
public void foo(){
class C{
public void bar(){
baz();
}
}
}
public void baz(){}
}
public void baz(){}
}
If i call baz() in C.bar(), it will call B.baz(). If i make a reference in A from this, (A aref = this;) then i can call A.baz() through it. Is there any other way to do this?
You may use A.this.baz()
. A.this
is called a qualified this expression .
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.