正在阅读:学习和使用继承时先要清楚的三点学习和使用继承时先要清楚的三点

2004-03-09 09:56 出处:PConline 作者:qlampskyface 责任编辑:linjixiong

  }

  class Super {
  protected int i;
  void plus(int i) {
    this.i += i;
  }
  }

  class Sub
    extends Super {
  protected int i = 1;
  void plus(int i){
    this.i=i+5;
  }
  }


  下面这个叫重建,不是重载:

  public class Temp {
    public static void main(String[] args) {
      Sub sub = new Sub();


 

察看评论详细内容 我要发表评论
作者笔名简短内容 发表时间
:

键盘也能翻页,试试“← →”键

关注我们

最新资讯离线随时看 聊天吐槽赢奖品