文件名称:ExtendsDemo
介绍说明--下载内容均来自于网络,请自行研究使用
* 继承关系
* 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-fr a me 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-fr a me 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