super is used in anonymous inner classes

1. The problem description
originally added a protected method to the parent class during refactoring (this method appears in many places in the subclass), and then used super to call this method in the subclass where this method is used, and the result compiles Always wrong. The compiler prompts that there is no such method under super.

2. After analysis and
comparison of the problem, it is found that some places can be used, and some places cannot be used. It turns out that the fundamental reason is that some subclass methods use anonymous inner classes . The use of super in inner class methods naturally represents not the parent class of the outer class, but the parent class of the inner class itself. The reason is clear, and I almost began to doubt life:)

3. Review
3.1 super keywords
http://blog.csdn.net/anmei2010/article/details/4093118

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326564708&siteId=291194637