Skip to content

Instantly share code, notes, and snippets.

@ezura
Created February 6, 2016 07:14
Show Gist options
  • Save ezura/f6babe3cb1a147cc537b to your computer and use it in GitHub Desktop.
Save ezura/f6babe3cb1a147cc537b to your computer and use it in GitHub Desktop.
優先順位について #CodePiece #cswift
protocol MyProtocol {
func method1() -> String
}
extension MyProtocol {
func method1() -> String {
return "protocol (1)"
}
func method2() -> String {
return "protocol (2)"
}
}
struct MyStruct: MyProtocol {
func method1() -> String {
return "struct (1)"
}
}
let a = MyStruct()
a.method1() // struct (1)
a.method2() // protocol (2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment