Last active
April 16, 2020 19:02
-
-
Save FabP93/280cec980533a8bc95aa5cd36d2fe28c to your computer and use it in GitHub Desktop.
Mixing generics and Subtypes Part 1
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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