This repository has been archived on 2021-09-07. You can view files and clone it, but cannot push or open issues or pull requests.
2018-12-01 12:09:22 +08:00

33 lines
298 B
Go

package main
import "fmt"
type Base struct {
}
func (b Base) Print() {
fmt.Println("这是print方法")
}
func (b Base) Echo() {
}
type Son struct {
Base
}
func (s Son) Echo() {
fmt.Println("这是Echo方法")
}
func main() {
// 模板模式
s := new(Son)
s.Print()
s.Echo()
}