     }
 }
 
-var p = Person("Kingcos")
-let tShirtA = TShirt()
-let chineseTunicSuitA = ChineseTunicSuit()
+var p = Boy("Kingcos")
 
 // 按顺序装饰
-tShirtA.decorate(p)
-chineseTunicSuitA.decorate(tShirtA)
+let tShirtA = TShirt(p)
+let chineseTunicSuitA = ChineseTunicSuit(tShirtA)
 
 chineseTunicSuitA.show()
 
-let tShirtB = TShirt()
-let chineseTunicSuitB = ChineseTunicSuit()
-
-chineseTunicSuitB.decorate(p)
-tShirtB.decorate(chineseTunicSuitB)
+let chineseTunicSuitB = ChineseTunicSuit(p)
+let tShirtB = TShirt(chineseTunicSuitB)
 
 tShirtB.show()


import UIKit

class Person {
    var name = ""
    
    init() {}
    
    init(_ name: String) {
        self.name = name
    }


// 饰物
class Finery: Person {
    var component: Person
    
    init(_ component: Person) {
        self.component = component
    }
    
    func show() {
        component.show()
    }
}
