Skip to content

Instantly share code, notes, and snippets.

@FabP93
Last active April 16, 2020 19:05
Show Gist options
  • Save FabP93/788bf342dc5c63da9b1e67f3d6d32a35 to your computer and use it in GitHub Desktop.
Save FabP93/788bf342dc5c63da9b1e67f3d6d32a35 to your computer and use it in GitHub Desktop.
Mixing generics and Subtypes Part 3
let pushups = Array<Pushup>()
// This doesn't raise any error because built-in
// generic types are covariant.
var exercises: Array<Exercise> = pushups
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment