Skip to content

Instantly share code, notes, and snippets.

@chadaustin
Created September 20, 2016 17:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chadaustin/3cae9eae9e837329ff8049450a088cfe to your computer and use it in GitHub Desktop.
Save chadaustin/3cae9eae9e837329ff8049450a088cfe to your computer and use it in GitHub Desktop.
protocol P {
func go()
}
extension String: P {
func go() {
print("String")
}
}
extension Int: P {
func go() {
print("Int")
}
}
func concrete<T: P>(_ a: T) {
a.go()
}
func abstract(a: P) {
concrete(a)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment