1 /*
2 定义:
3 type 接口名 interface{
4 方法名(可选:参数列表) 可选:返回值列表 || (可选:返回值列表)
5 }
6 例:type Writer interface {
7 Write(p []byte) (n int, err error)
8 }
9 type Objecter interface{//定义接口
10 say(class int, value string) (b bool, err error)
11 }
12 实现接口:
13 1:接口的方法与实现接口的类型方法格式一致
14 2:当一个接口中有多个方法时,只有这些方法都被实现了,接口才能被正确编译并使用
15 */
16
17 package info_interface
18
19 import "fmt"
20
21 func Say(){
22 fmt.Println("info_interface")
23 }