타입 캐스팅
import UIKit
class Coffee {
    let name: String
    let shot: Int
    let price: Int
    
    var description: String {
        return "\(name) \(shot)샷 나왔습니다. \(price)원 입니다."
    }
    init(name: String, shot: Int, price: Int) {
        self.name = "cofee"
        self.shot = shot
        self.price = price
    }
}
class Americano: Coffee {
    var 원두타입: String
    
    override var description: String {
        return "\(원두타입) 아메리카노 \(shot)샷 나왔습니다. \(price)원 입니다."
    }
    
    init(원두타입: String, shot: Int, price: Int) {
        self.원두타입 = 원두타입
        super.init(name: "아메리카노", shot: shot, price: price)
    }
}
class Latte: Coffee {
    var 우유: String
    var 설탕: String
    
    override var description: String {
        return "\(설탕) 라떼 \(shot)샷 나왔습니다. \(price)원 입니다."
    }
    
    init(우유: String, 설탕: String, shot: Int, price: Int) {
        self.우유 = 우유
        self.설탕 = 설탕
        super.init(name: "라떼", shot: shot, price: price)
    }
}
let 다방커피: Coffee = Latte(우유: "메일우유", 설탕: "백설탕", shot: 2, price: 3000)
let 찐커피 = Coffee(name: "맛 없는 커피", shot: 1, price: 800)
if let 라떼행세를하는그냥커피: Latte = 찐커피 as? Latte {
    라떼행세를하는그냥커피.설탕
    라떼행세를하는그냥커피.우유
}
let 찐라떼 = Latte(우유: "그냥우유", 설탕: "3스푼", shot: 2, price: 300)
if let 아메리카노행세를하는그냥커피: Americano = 찐커피 as? Americano {
    아메리카노행세를하는그냥커피.원두타입
}
if let 아메리카노행세를하는라떼: Americano = 찐라떼 as? Americano {
    
    
}
struct 커피머신 {
    var coffee: Coffee
}
let 써니의커피머신 = 커피머신(coffee: Latte(우유: "오늘우유", 설탕: "서얼탕", shot: 3, price: 8000))
let 제임스의커피머신 = 커피머신(coffee: Americano(원두타입: "쿠바", shot: 3, price: 10000))