Home  >  Q&A  >  body text

intellij-idea - Java混型的问题?

假设我有三个接口A1, B1, C1,他们都有各自的方法。

然后是三个实现类A2, B2, C2。

接下来,通过使用Mix类将三个接口包装起来。

这里B2, C2接口使用了代理,而A2则通过继承获取。

问题来了,为何不能使用Mix的对象调用A1的方法?

巴扎黑巴扎黑2713 days ago769

reply all(1)I'll reply

  • 高洛峰

    高洛峰2017-04-18 10:55:36

    Ugh. . .

    That, m1.a(); This sentence seems not to be written in the function body, but directly under the curly braces of the class body, but it is not a statement used to declare members of the Test class.

    reply
    0
  • Cancelreply