| 43 | |
| 44 | |
| 45 | class Rect(Shape): |
| 46 | |
| 47 | def __init__(self, width, height): |
| 48 | self._width = width |
| 49 | self._height = height |
| 50 | |
| 51 | def perimeter(self): |
| 52 | return 2 * (self._width + self._height) |
| 53 | |
| 54 | def area(self): |
| 55 | return self._width * self._height |
| 56 | |
| 57 | def __str__(self): |
| 58 | return '我是一个矩形' |
| 59 | |
| 60 | |
| 61 | if __name__ == '__main__': |