Reputation: 1169
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?
Upvotes: 3
Views: 244
Reputation: 6181
You may use A.this.baz()
. A.this
is called a qualified this expression.
Upvotes: 8