Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

代码结构

- src
  - GameTemplate.go # 定义抽象模板类的公共部分,这里用struct替代
  - TemplateInterface.go # 定义抽象模板接口,包括各种动作,供子类去实现
  - Basketball.go # 具体的模板实现,覆盖父类
  - Football.go # 具体的模板实现,覆盖父类
  - Tennis.go # 具体的模板实现,覆盖父类

测试验证

$ cd ./template-pattern/go
$ go run test/test.go