1. 首页
  2. 数据库
  3. 其它
  4. go接口类型(interface)

go接口类型(interface)

上传者: 2021-02-06 23:10:44上传 PDF文件 35.29KB 热度 13次
接口 (Interfaces) 是命名了的方法签名 (signatures) 的集合 package main import fmt import math // 这里是一个几何体的基本接口。 type geometry interface { area() float64 perim() float64 } // 在我们的例子中,我们将在类型 `rect` 和 `circle` 上实现 // 这个接口 type rect struct { width, height float64 } type circle struct { radius float
下载地址
用户评论