mirror of
https://github.com/unknwon/the-way-to-go_ZH_CN.git
synced 2025-08-12 00:11:36 +08:00
fix: fix a lot of incorrect links (#849)
This commit is contained in:
@@ -278,7 +278,7 @@ func main() {
|
||||
|
||||
{5} {5} {5}
|
||||
|
||||
**练习 10.1** [vcard.go](exercises\chapter_10\vcard.go):
|
||||
**练习 10.1** [vcard.go](exercises/chapter_10/vcard.go):
|
||||
|
||||
定义结构体 `Address` 和 `VCard`,后者包含一个人的名字、地址编号、出生日期和图像,试着选择正确的数据类型。构建一个自己的 `vcard` 并打印它的内容。
|
||||
|
||||
@@ -287,15 +287,15 @@ func main() {
|
||||
第二种会好点,因为它占用内存少。包含一个名字和两个指向地址的指针的 Address 结构体可以使用 %v 打印:
|
||||
{Kersschot 0x126d2b80 0x126d2be0}
|
||||
|
||||
**练习 10.2** [personex1.go](exercises\chapter_10\personex1.go):
|
||||
**练习 10.2** [personex1.go](exercises/chapter_10/personex1.go):
|
||||
|
||||
修改 personex1.go,使它的参数 `upPerson` 不是一个指针,解释下二者的区别。
|
||||
|
||||
**练习 10.3** [point.go](exercises\chapter_10\point.go):
|
||||
**练习 10.3** [point.go](exercises/chapter_10/point.go):
|
||||
|
||||
使用坐标 `X`、`Y` 定义一个二维 `Point` 结构体。同样地,对一个三维点使用它的极坐标定义一个 `Polar` 结构体。实现一个 `Abs()` 方法来计算一个 `Point` 表示的向量的长度,实现一个 `Scale()` 方法,它将点的坐标乘以一个尺度因子(提示:使用 `math` 包里的 `Sqrt()` 函数)(function Scale that multiplies the coordinates of a point with a scale factor)。
|
||||
|
||||
**练习 10.4** [rectangle.go](exercises\chapter_10\rectangle.go):
|
||||
**练习 10.4** [rectangle.go](exercises/chapter_10/rectangle.go):
|
||||
|
||||
定义一个 `Rectangle` 结构体,它的长和宽是 `int` 类型,并定义方法 `Area()` 和 `Perimeter()`,然后进行测试。
|
||||
|
||||
|
Reference in New Issue
Block a user