JAVA05继承与多态.pptVIP

  • 4
  • 0
  • 约5.84千字
  • 约 23页
  • 2016-12-11 发布于重庆
  • 举报
* JComponent starts the new Swing hierarchy added in Java 2. * In the computer world, the term interface refers to any mechanism that connects two devices or entities and defines the rules for their interaction. 第5章 继承与多态 继承 继承表示对象间的 IS-A 关系 an object of a subclass IS-A(n) object of the superclass. Superclass (Base class) Subclass (Derived class) Subclass extends Superclass 继承 允许定义一个类作为另一个类的扩充版本 动物 哺乳动物 鸟类 狗 猫 雀 鸡 基类和派生类 继承就是从已有的一个类派生出新的类。派生类中可以继承基类中已有的特性(数据成员与成员函数),并且还可以增加自已新的特性。 从现存类(基类)派生出派生类时,可以在派生类中做以下变化: 增加新的数据成员 增加新的成员函数 重新定义已有的成员函数 改变现成员的属性 继承(cont’d) 共同的属性只需要描述一次 创建两个非常相似的类时,不再需要重

文档评论(0)

1亿VIP精品文档

相关文档