Avatar
これも rotocol A { associatedtype B = String func hello() -> B } extension A where B == String { func hello() -> B { return "hello" } } extension A where B == Int { func hello() -> B { return 1 } } class C: A {} C().hello() // "hello"