设计模式 decorator_test 实现
golang 设计模式 decorator_test 代码实现
package decorator
import "fmt"
func ExampleDecorator() {
	var c Component = &ConcreteComponent{}
	c = WarpAddDecorator(c, 10)
	c = WarpMulDecorator(c, 8)
	res := c.Calc()
	fmt.Printf("res %d\n", res)
	// Output:
	// res 80
}
目录
相关文章
                        
                            0
                        
                        
                             赞
                        
                    
                    
                热门推荐
- 
                        2、 - 优质文章
- 
                        3、 gate.io
- 
                        8、 openharmony
- 
                        9、 golang