Skip to content

Instantly share code, notes, and snippets.

@dduan
Created April 8, 2016 22:57
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 dduan/8b0dcbd484aaa7ff35807ec8c8819f3d to your computer and use it in GitHub Desktop.
Save dduan/8b0dcbd484aaa7ff35807ec8c8819f3d to your computer and use it in GitHub Desktop.
Quiz time!
func f<T, U>(x: T.Type, _ y: U) -> Bool {
return y is T
}
func g<T, U>(x: T, _ y: U) -> Bool {
return y is T
}
protocol P {}
class B: P {}
// what would be the output?
f(P.self, B())
g(P.self, B())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment