Avatar
omochimetaru 5/9/2017 7:15 AM
protocol P { associatedtype AT } struct SP<T> : P { typealias AT = T } extension P where AT == Int { func po() { print("AT == Int") } } extension P where AT == String { func po() { print("AT == String") } } let intsp = SP<Int>() intsp.po() let strsp = SP<String>() strsp.po()
7:15 AM
associatedtypeでオーバーロードがやりたい
だけだと、これでできているように見える?