Created
March 3, 2016 02:54
-
-
Save sinsoku/a9c3e9068dd194b3c52d to your computer and use it in GitHub Desktop.
diamond problem
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protocol StringConvertible {} | |
extension StringConvertible { | |
func toString() -> String { | |
return "StringConvertible: \(self)" | |
} | |
} | |
protocol StringType {} | |
extension StringType { | |
func toString() -> String { | |
return "StringType: \(self)" | |
} | |
} | |
class User : StringConvertible, StringType {} | |
let userA:StringConvertible = User() | |
print(userA.toString()) // StringConvertible: User | |
let userB:StringType = User() | |
print(userB.toString()) // StringType: User |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment