文件名称:ExtendsDemo
-
所属分类:
- 标签属性:
- 上传时间:2015-02-15
-
文件大小:1.23kb
-
已下载:0次
-
提 供 者:
-
相关连接:无下载说明:别用迅雷下载,失败请重下,重下不扣分!
介绍说明--下载内容来自于网络,使用问题请自行百度
* 继承关系
* 1.子类继承父类的属性和方法,父类的属性和方法被所有子类共享
* 2.子类多种多样,子类是多态的
* 业务案例:四格方块(Tetromino)有七种(I,J,L,S,Z,T,O)
* 实现方式:
* 利用继承关系实现,其中四格方块是父类,七种方块是
* 子类,在父类定义四格数组的属性,子类就自动继承了
* 四格属性。
* 定义四格方块类(Tetronimo),属性:4格子,方法:下落
* 子类型继承4格方块类的属性和方法
* 子类型每个方块都不同,所以要在子类添加构造器以便以初始化格子位置-* Inheritance* properties and methods 1. subclass inherits the parent class, properties and methods of the parent class is shared by all subclasses* 2. subclass diverse subclass is polymorphic* Business case: four grid squares ( Tetromino) There are seven (I, J, L, S, Z, T, O)* implementations:* use inheritance to achieve, which is the parent class four grid squares or seven square is* a subclass is defined in the parent class Properties fourfold array subclass automatically inherits* fourfold property.* Define a four-frame box type (Tetronimo), attribute: 4 lattice method: Drop* subtype inherits the properties and methods of the class* 4 grid squares subtype each box is different, so you want to add to the subclass constructor to initialize grid position
* 1.子类继承父类的属性和方法,父类的属性和方法被所有子类共享
* 2.子类多种多样,子类是多态的
* 业务案例:四格方块(Tetromino)有七种(I,J,L,S,Z,T,O)
* 实现方式:
* 利用继承关系实现,其中四格方块是父类,七种方块是
* 子类,在父类定义四格数组的属性,子类就自动继承了
* 四格属性。
* 定义四格方块类(Tetronimo),属性:4格子,方法:下落
* 子类型继承4格方块类的属性和方法
* 子类型每个方块都不同,所以要在子类添加构造器以便以初始化格子位置-* Inheritance* properties and methods 1. subclass inherits the parent class, properties and methods of the parent class is shared by all subclasses* 2. subclass diverse subclass is polymorphic* Business case: four grid squares ( Tetromino) There are seven (I, J, L, S, Z, T, O)* implementations:* use inheritance to achieve, which is the parent class four grid squares or seven square is* a subclass is defined in the parent class Properties fourfold array subclass automatically inherits* fourfold property.* Define a four-frame box type (Tetronimo), attribute: 4 lattice method: Drop* subtype inherits the properties and methods of the class* 4 grid squares subtype each box is different, so you want to add to the subclass constructor to initialize grid position
(系统自动生成,下载前可以参看下载内容)
下载文件列表
ExtendsDemo.java
本网站为编程资源及源代码搜集、介绍的搜索网站,版权归原作者所有! 粤ICP备11031372号
1999-2046 搜珍网 All Rights Reserved.