1第十章抽象类和接口 2第一个话题:抽象类 F在类的继承层次中,子类越来越具体, 而父类更加一般化和抽象,类设计过程中应使父类包含子类的一般特征,有时父类太抽象而不能有一个具体的实例, 称为抽象类 3 The abstract Modifier F The abstract class –不能被实例化–在子类中扩展和实现 F The abstract method –方法的标识,无须实现 4一个实例 GeometricObject - color: String - filled: boolean - dateCreated: +GeometricObject() +getColor(): String +setColor(color: String): void +isFilled( ): boolean +setFilled(filled: boolean): void +getDateCreated(): +toString(): String The color of the object (default: white) . Indicates whether the object is filled with a color (default: false) . The date when the object was created. Creates a GeometricObject. Returns the color. Sets a new color. Returns the filled pro perty. Sets a new filled property. Returns the dateCreated. Returns a string representation of this object. Circle - radius : double + Circle () + Circle(radius: double) + get Radius (): double +set Radius ( radius : double ): void +getArea(): double +getPerimeter(): double + getDiameter(): double Rectangle - width : double - height : double + Rectangle () + Rectangle(width: double, height: double) +getWidth(): double +setWidth(width: double): void +getHeight(): double +setHeight(height: double): void +getArea(): double +getPerimeter(): double5 Abstract Classes GeometricObject Circle Rectangle GeometricObject - color: String - filled: boolean - dateCreated: # GeometricObject() +getColor(): String +setColor(color: String): void +isFilled(): boolean +setFilled(filled: boolean): void +getDateCreated(): +toStri ng(): String +getArea(): double +getPerimeter(): double Circle - radius : double + Circle () + Circle(radius: double) + get Radius (): double +set Radius ( radius : double ): void +getDiameter(): double Rectangle - width : double - height : double + Rectangle () + Rectangle(width: double, height: double) +getWidth(): double +setWidth(width: double): void +getHeight(): double +setHeight(height: dou ble): void The # sign indicates
java 第十章-课件(PPT讲稿) 来自淘豆网m.daumloan.com转载请标明出处.