内在的阶级延伸 [英] inner class extending

查看:89
本文介绍了内在的阶级延伸的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在java中,假设我有以下类:

In java, say I have the following class:

public class A{
  protected class B{
  }
}

我可以通过执行以下操作来扩展内部类吗? / p>

can I extend the inner class by doing the following?

public class C extends A{
  protected class D extends B{
  }
}

我想做的是我上面有C级,我需要在A的内部改变一些东西所以我认为我需要扩展内部类来这样做,但我不确定如何做到这一点。

What I want to do is that I have the class C above and I need to change something in A's inner class so I was thinking that I need to extend the inner class to do so but I wasn't sure how exactly to do that.

推荐答案

根据此页,您有正确的方法可以扩展内部类。关于它的一些提示可以在文章的中间这里找到(搜索延长)。

According to this page, you have the right way figured out to extend inner classes. A few tips about it can be found here, in the middle of the article (search for "extend").

这篇关于内在的阶级延伸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆