HugBoomsj 4年前

修改理由:

函数名不一致

相关信息:


此投稿已在 4年前 合并。

内容修改:

红色背景 为原始内容

绿色背景 为新增或者修改的内容

OldNewDifferences
1 查看如下程序:`nexter` 是一个接口类型,并且定义了一个 `next()` 方法读取下一字节。函数 `nextFew` 将 `nexter` 接口作为参数并读取接下来的 `num` 个字节,并返回一个切片:这是正确做法。但是 `nextFew2` 使用一个指向 `nexter` 接口类型的指针作为参数传递给函数:当使用 `next()` 函数时,系统会给出一个编译错误:**n.next undefined (type *nexter has no
 1查看如下程序:`nexter` 是一个接口类型,并且定义了一个 `next()` 方法读取下一字节。函数 `nextFew1` 将 `nexter` 接口作为参数并读取接下来的 `num` 个字节,并返回一个切片:这是正确做法。但是 `nextFew2` 使用一个指向 `nexter` 接口类型的指针作为参数传递给函数:当使用 `next()` 函数时,系统会给出一个编译错误:**n.next undefined (type *nexter has no
22field or method next)** (译者注:n.next未定义(*nexter类型没有next成员或next方法))
33
44例 16.1 pointer_interface.go (不能通过编译):