Consider these classes:
struct OrderedSet {}
class Exercise: Hashable {}
class StrengthExercise: Exercise {}
class CardioExercise: Exer
As the OrderedSet
is of that specific type it cannot be assigned to the more general OrderedSet
. Think about what would happen if you tried to append a Cardio exercise to that OrderedSet after assigning it.
The answer might be to modify append the contents of the strength exercises set to the exercise set rather than assign the whole typed set.