Skip to content

Instantly share code, notes, and snippets.

@ktakayama
Created March 29, 2016 23:31
Show Gist options
  • Save ktakayama/7a302c2ab503b1f22062990617c123e3 to your computer and use it in GitHub Desktop.
Save ktakayama/7a302c2ab503b1f22062990617c123e3 to your computer and use it in GitHub Desktop.
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