摘要: 一、接口 type Car interface { //定义一个Car的接口 what() //定义一个方法 } type Bicycle struct { } type Motor struct { } func (bicycle Bicycle) what() { fmt.Println("I 阅读全文
posted @ 2020-12-02 18:52 Auler 阅读(120) 评论(0) 推荐(0) 编辑
摘要: 一、切片Slice func main() { fmt.Println("Hello, World!") s := []int{1, 2, 3} //数组 printSlice(s) fmt.Println(s[0:2]) //使用切片方式 fmt.Println(s[:2]) fmt.Printl 阅读全文
posted @ 2020-12-02 13:27 Auler 阅读(97) 评论(0) 推荐(0) 编辑