design-patterns-go icon indicating copy to clipboard operation
design-patterns-go copied to clipboard

Optimize the template method pattern, call genAndSendOTP function by concrete product class

Open wuye251 opened this issue 2 years ago • 0 comments
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)

wuye251 avatar Feb 21 '23 14:02 wuye251