Last active
April 16, 2020 19:03
-
-
Save FabP93/418dcae1fcbe360a45f7e82528492acb to your computer and use it in GitHub Desktop.
Mixing generics and Subtypes Part 2
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
struct Activity<T> {} | |
var pushup = Activity<Pushup>() | |
// You can't do this, it raises the error: | |
// Cannot assign value of type 'Activity<Pushup>' to type 'Activity<Exercise>' | |
var activity: Activity<Exercise> = pushup |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment