You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _tour/variances.md
+1-1
Original file line number
Diff line number
Diff line change
@@ -53,7 +53,7 @@ What about boxes? Is `Box[Cat]` a subtype of `Box[Animal]`, like `Cat` is a subt
53
53
Why could this be a problem? We can get the cat from the box, and it's still an Animal, isn't it? Well, yes. But that's not all we can do. We can also replace the cat in the box with a different animal
54
54
55
55
```scala
56
-
mayAnimalBox.content =Dog("Fido")
56
+
myAnimalBox.content =Dog("Fido")
57
57
```
58
58
59
59
There now is a Dog in the Animal box. That's all fine, you can put Dogs in Animal boxes, because Dogs are Animals. But our Animal Box is a Cat Box! You can't put a Dog in a Cat box. If we could, and then try to get the cat from our Cat Box, it would turn out to be a dog, breaking type soundness.
0 commit comments