Created
March 29, 2016 23:31
-
-
Save ktakayama/7a302c2ab503b1f22062990617c123e3 to your computer and use it in GitHub Desktop.
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 SpeakProtocol { | |
// func speak() -> String | |
func instinctSpeak() -> String | |
} | |
extension SpeakProtocol { | |
func speak() -> String { | |
return "I am anything" | |
} | |
func instinctSpeak() -> String { | |
return speak() | |
} | |
} | |
struct Human: SpeakProtocol { | |
func speak() -> String { | |
return "I am human" | |
} | |
} | |
let human = Human() | |
human.speak() | |
human.instinctSpeak() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment