Skip to content

Instantly share code, notes, and snippets.

@FabP93
Last active April 16, 2020 19:02
Show Gist options
  • Save FabP93/280cec980533a8bc95aa5cd36d2fe28c to your computer and use it in GitHub Desktop.
Save FabP93/280cec980533a8bc95aa5cd36d2fe28c to your computer and use it in GitHub Desktop.
Mixing generics and Subtypes Part 1
class Exercise {
func perform() {}
func stop() {}
}
class Pushup: Exercise {
override func perform() {}
override func stop() {}
}
// This is fine, you can assign Pushup to Exercise
let exercise: Exercise = Pushup()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment