package facade import "fmt" type CarModel struct { } func (c *CarModel) SetModel() { fmt.Println("SetModel测试...", c) } type CarEngine struct { } func (c *CarEngine) SetEngine() { fmt.Println("SetEngine测试...", c) } type CarBody struct { } func (c *CarBody) SetBody() { fmt.Println("SetBody测试...", c) } type CarFacade struct { model CarModel engine CarEngine body CarBody } func (c *CarFacade) CreateCompleteCar() { c.model.SetModel() c.engine.SetEngine() c.body.SetBody() }