package
0.0.0-20240902082406-25d27471d586
Repository: https://github.com/hexiaopi/go-notes.git
Documentation: pkg.go.dev
# README
模版方法模式
定义一个操作中的算法骨架,而将算法中的一些步骤延迟到子类中,使得子类可以不改变该算法结构的情况下重定义该算法的某些特定步骤。
如实例代码中通用步骤在父类中实现(准备
、下载
、保存
、收尾
)下载和保存的具体实现留到子类中,并且提供 保存
方法的默认实现。
因为Golang不提供继承机制,需要使用匿名组合模拟实现继承。
此处需要注意:因为父类需要调用子类方法,所以子类需要匿名组合父类的同时,父类需要持有子类的引用。
# Functions
No description provided by the author
No description provided by the author
# Structs
No description provided by the author
No description provided by the author
# Interfaces
No description provided by the author