摘要:
一、接口 type Car interface { //定义一个Car的接口 what() //定义一个方法 } type Bicycle struct { } type Motor struct { } func (bicycle Bicycle) what() { fmt.Println("I 阅读全文
摘要:
一、切片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 阅读全文