123456789101112131415161718192021222324252627 |
- package model
- import "fmt"
- //接口
- type Live interface {
- run(i int)
- eat(thing string)
- }
- type People struct {
- name string
- }
- func (p *People) run(i int) {
- fmt.Println(p.name, "跑了", i, "米")
- }
- func (p *People) eat(thing string) {
- fmt.Println(p.name, "正在吃", thing)
- }
- func main() {
- peo := People{"derek"}
- peo.run(100)
- peo.eat("面包")
- }
|