design-patterns-go
design-patterns-go copied to clipboard
Optimize the template method pattern, call genAndSendOTP function by concrete product class
trafficstars
Hello When I was learning about the template method pattern from your book, I found that the code implemented by go might have a better way to call it, concrete's genAndSendOTP can use concrete instead of concrete template class or base class. The way to call will better.
eg: smsOTP.genAndSendOTP(4) instead of o.genAndSendOTP(4)