Getting hold of the outer class object from the inner class object

前端 未结 8 1461
孤独总比滥情好
孤独总比滥情好 2020-11-22 02:26

I have the following code. I want to get hold of the outer class object using which I created the inner class object inner. How can I do it?

pub         


        
8条回答
  •  说谎
    说谎 (楼主)
    2020-11-22 03:11

    if you don't have control to modify the inner class, the refection may help you (but not recommend). this$0 is reference in Inner class which tells which instance of Outer class was used to create current instance of Inner class.

提交回复
热议问题