Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- enum ShapeType {circle, square};
- interface IShape {
- const static ShapeType shapeType;
- void Draw();
- }
- class Circle implements IShape {
- const static ShapeType SHAPE_TYPE = ShapeType.circle;
- public Circle(int radius, Point center) {
- this.radius = radius;
- this.center = center;
- }
- public Draw() {
- /* 描く処理 */
- }
- }
- class Square implements IShape {
- const static ShapeType SHAPE_TYPE = ShapeType.square;
- public Square(int side, Point topLeft) {
- this.side = side;
- this.topLeft = topLeft;
- }
- public Draw() {
- /* 描く処理 */
- }
- }
- class BigCircle extends Circle {}
- class BigSquare extends Square {}
Add Comment
Please, Sign In to add comment