hhyyg
8/30/2017 - 4:33 AM

protocol static 実験

protocol static 実験



protocol Person {
    static func memo()
}


class Taro: Person {
    static func memo() {
        print("taro")
    }
}

class Hanako: Person {
    static func memo() {
        print("hanako")
    }
}

func Output(type: Person.Type) -> Void {
    type.memo()
}

Output(type: Taro.self) //taro
Output(type: Hanako.self) //hanako