add an illustration

give a diagram for demonstrating the relationship among student human
and skills
This commit is contained in:
Wenlei
2012-10-13 19:00:47 +08:00
parent 800d2fe2cf
commit b5e6792f28
2 changed files with 3 additions and 0 deletions

3
2.4.md
View File

@@ -122,6 +122,9 @@ Go语言中也和C或者其他语言一样我们可以声明新的类型
fmt.Println("His weight is", mark.weight)
}
图例如下:
![](images/2.4.student_struct.png?raw=true)
我们看到Student访问属性age和name的时候就像访问自己所有用的字段一样匿名字段就是这样能够实现字段的继承。是不是很酷啊还有比这个更酷的呢那就是student还能访问Human这个字段作为字段名。请看下面的代码是不是更酷了。
mark.Human = Human{"Marcus", 55, 220}

Binary file not shown.

After

Width:  |  Height:  |  Size: 79 KiB