Guest User

Untitled

a guest
Apr 23rd, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.68 KB | None | 0 0
  1. enum ShapeType {circle, square};
  2.  
  3. interface IShape {
  4. const static ShapeType shapeType;
  5. void Draw();
  6. }
  7.  
  8. class Circle implements IShape {
  9. const static ShapeType SHAPE_TYPE = ShapeType.circle;
  10. public Circle(int radius, Point center) {
  11. this.radius = radius;
  12. this.center = center;
  13. }
  14. public Draw() {
  15. /* 描く処理 */
  16. }
  17. }
  18.  
  19. class Square implements IShape {
  20. const static ShapeType SHAPE_TYPE = ShapeType.square;
  21. public Square(int side, Point topLeft) {
  22. this.side = side;
  23. this.topLeft = topLeft;
  24. }
  25. public Draw() {
  26. /* 描く処理 */
  27. }
  28. }
  29.  
  30.  
  31. class BigCircle extends Circle {}
  32. class BigSquare extends Square {}
Add Comment
Please, Sign In to add comment