Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

Go Decoration Mode, the Story of a loser

Shulou Source: shulou.com Published: 2022-06-03 06:51:06 10月03日 Update

Go directly to the code:

Package mainimport "fmt" / / now there is a loser, there is a management method, our requirement is to wear pants type diaosi struct {} func (b * diaosi) LUALU () {fmt.Println ("EN...") before and after the pipe. a.。 A...OH GOD..FUCK.. me.. ")} type decorator struct {* diaosi LUALU func ()} func decorat (b * diaosi) (d * decorator) {d = & decorator {b, nil} d.LUALU = func () {fmt.Println (" take off trousers... ") B.LUALU () fmt.Println ("take on trousers...")} return} func main () {/ / hanging wire LOL b: = & diaosi {} b.LUALU () fmt.Println ("=") / / hanging wire * sub-> LOL-> wearing trousers c: = decorat (b) c.LUALU () / / Job: losers open × × -> * * sub-> LOL-> wear pants-> Guan × × how to achieve it? }

Tags: Pants code method is in requirements assignments stories patterns Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information Redmi Shulou Tech Info Huawei Shulou Technology