Last updated 2 years ago
一個 method 與函式的差異為何?
為何你要使用一個嵌入式匿名欄位,而不使用一般的命名欄位呢?
在 Shape interface 新增一個稱為 perimeter 的新 method,perimeter 可以計算 shape 的週長,請為 Circle 與 Rectangle 實做 method。
Shape
perimeter
Circle
Rectangle