mirror of
https://github.com/unknwon/the-way-to-go_ZH_CN.git
synced 2025-08-24 14:30:50 +08:00
mend
This commit is contained in:
@@ -658,7 +658,7 @@ func (i *Integer) String() string {
|
||||
|
||||
在 Go 中,类型就是类(数据和关联的方法)。Go 不知道类似面向对象语言的类继承的概念。继承有两个好处:代码复用和多态。
|
||||
|
||||
在 Go 中,代码复用通过组合和委托实现,多态通过接口的使用来实现:有时这也叫 **组件编程(component programming)**。
|
||||
在 Go 中,代码复用通过组合和委托实现,多态通过接口的使用来实现:有时这也叫 **组件编程(Component Programming)**。
|
||||
|
||||
许多开发者说相比于类继承,Go 的接口提供了更强大、却更简单的多态行为。
|
||||
|
||||
|
Reference in New Issue
Block a user