Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

calling the right "this" object from inner class  RSS feed

 
Neo Adela
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm trying to use the 'this' keyword to access my main class for a certain function, but because I am inside of an inner class (an Action Listener), 'this' references the inner class instead of the outer class. How can I modify my call to 'this' so that I can have access to the outer class?
 
Tony Docherty
Bartender
Posts: 3268
82
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You preceed it with the name of the outer class eg

 
Neo Adela
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you.
 
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!