add an illustration
give a diagram for demonstrating the relationship among student human and skills
This commit is contained in:
3
2.4.md
3
2.4.md
@@ -122,6 +122,9 @@ Go语言中,也和C或者其他语言一样,我们可以声明新的类型
|
|||||||
fmt.Println("His weight is", mark.weight)
|
fmt.Println("His weight is", mark.weight)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
图例如下:
|
||||||
|

|
||||||
|
|
||||||
我们看到Student访问属性age和name的时候,就像访问自己所有用的字段一样,对,匿名字段就是这样,能够实现字段的继承。是不是很酷啊?还有比这个更酷的呢,那就是student还能访问Human这个字段作为字段名。请看下面的代码,是不是更酷了。
|
我们看到Student访问属性age和name的时候,就像访问自己所有用的字段一样,对,匿名字段就是这样,能够实现字段的继承。是不是很酷啊?还有比这个更酷的呢,那就是student还能访问Human这个字段作为字段名。请看下面的代码,是不是更酷了。
|
||||||
|
|
||||||
mark.Human = Human{"Marcus", 55, 220}
|
mark.Human = Human{"Marcus", 55, 220}
|
||||||
|
|||||||
BIN
images/2.4.student_struct.png
Normal file
BIN
images/2.4.student_struct.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 79 KiB |
Reference in New Issue
Block a user