Make more accurate description

This commit is contained in:
Andrew-liu
2016-04-12 23:52:34 +08:00
parent 57b8043440
commit c78964131f
2 changed files with 2 additions and 2 deletions

View File

@@ -130,7 +130,7 @@ Go语言中也和C或者其他语言一样我们可以声明新的类型
![](images/2.4.student_struct.png?raw=true)
图2.7 StudentHuman的方法继承
图2.7 struct组合Student组合了Human struct和string基本类型
我们看到Student访问属性age和name的时候就像访问自己所有用的字段一样匿名字段就是这样能够实现字段的继承。是不是很酷啊还有比这个更酷的呢那就是student还能访问Human这个字段作为字段名。请看下面的代码是不是更酷了。

View File

@@ -3,7 +3,7 @@
## interface
Go语言里面设计最精妙的应该算interface它让面向对象内容组织实现非常的方便当你看完这一章你就会被interface的巧妙设计所折服。
### 什么是interface
简单的说interface是一组method的组合我们通过interface来定义对象的一组行为。
简单的说interface是一组method签名的组合我们通过interface来定义对象的一组行为。
我们前面一章最后一个例子中Student和Employee都能SayHi虽然他们的内部实现不一样但是那不重要重要的是他们都能`say hi`