改正错别字及微调格式 (#782)

This commit is contained in:
SiHuan
2020-11-24 01:46:48 +08:00
committed by GitHub
parent d89b99b642
commit 806880974d
43 changed files with 894 additions and 894 deletions

View File

@@ -1,29 +1,29 @@
# 11.2 接口嵌套接口
一个接口可以包含一个或多个其他的接口,这相当于直接将这些内嵌接口的方法列举在外层接口中一样。
比如接口 `File` 包含了 `ReadWrite``Lock` 的所有方法,它还额外有一个 `Close()` 方法。
```go
type ReadWrite interface {
Read(b Buffer) bool
Write(b Buffer) bool
}
type Lock interface {
Lock()
Unlock()
}
type File interface {
ReadWrite
Lock
Close()
}
```
## 链接
- [目录](directory.md)
- 上一节:[接口是什么](11.1.md)
- 下一节:[如何检测和转换接口变量的类型:类型断言](11.3.md)
# 11.2 接口嵌套接口
一个接口可以包含一个或多个其他的接口,这相当于直接将这些内嵌接口的方法列举在外层接口中一样。
比如接口 `File` 包含了 `ReadWrite``Lock` 的所有方法,它还额外有一个 `Close()` 方法。
```go
type ReadWrite interface {
Read(b Buffer) bool
Write(b Buffer) bool
}
type Lock interface {
Lock()
Unlock()
}
type File interface {
ReadWrite
Lock
Close()
}
```
## 链接
- [目录](directory.md)
- 上一节:[接口是什么](11.1.md)
- 下一节:[如何检测和转换接口变量的类型:类型断言](11.3.md)