簡易工廠模式 - Simple Factory
import Foundation
class LionCoffee {
static func createAmeraCoffee() -> LionCoffee {
return LionCoffee(aType: "美式咖啡")
}
static func createNateaCoffee() -> LionCoffee {
return LionCoffee(aType: "拿鐵咖啡")
}
static func createMoTeaCoffee() -> LionCoffee {
return LionCoffee(aType: "抹茶咖啡")
}
private var mType:String
init(aType:String){
mType = aType
}
}Last updated