|
@@ -174,6 +174,7 @@ func main() {
|
|
|
```
|
|
```
|
|
|
|
|
|
|
|
输出:
|
|
输出:
|
|
|
|
|
+
|
|
|
The sorted array is: [-5467984 -784 0 0 42 59 74 238 905 959 7586 7586 9845]
|
|
The sorted array is: [-5467984 -784 0 0 42 59 74 238 905 959 7586 7586 9845]
|
|
|
The sorted array is: [ friday monday saturday sunday thursday tuesday wednesday]
|
|
The sorted array is: [ friday monday saturday sunday thursday tuesday wednesday]
|
|
|
Sunday Monday Tuesday Wednesday Thursday Friday Saturday
|
|
Sunday Monday Tuesday Wednesday Thursday Friday Saturday
|
|
@@ -197,6 +198,7 @@ type Interface interface {
|
|
|
练习 11.5:interfaces_ext.go
|
|
练习 11.5:interfaces_ext.go
|
|
|
|
|
|
|
|
a). 继续扩展程序,定义类型 `Triangle`,让它实现 `AreaInterface` 接口。通过计算一个特定三角形的面积来进行测试(三角形面积=0.5 * (底 * 高))
|
|
a). 继续扩展程序,定义类型 `Triangle`,让它实现 `AreaInterface` 接口。通过计算一个特定三角形的面积来进行测试(三角形面积=0.5 * (底 * 高))
|
|
|
|
|
+
|
|
|
b). 定义一个新接口 `PeriInterface`,它有一个 `Perimeter` 接口。让 `Square` 实现这个接口,并通过一个 `Square` 示例来测试它。
|
|
b). 定义一个新接口 `PeriInterface`,它有一个 `Perimeter` 接口。让 `Square` 实现这个接口,并通过一个 `Square` 示例来测试它。
|
|
|
|
|
|
|
|
练习 11.6:point_interfaces.go
|
|
练习 11.6:point_interfaces.go
|