Skip to content

Commit c69596a

Browse files
authored
Merge pull request #2519 from syou98/patch-1
Update variances.md
2 parents 07d0e73 + b337928 commit c69596a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

_tour/variances.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ What about boxes? Is `Box[Cat]` a subtype of `Box[Animal]`, like `Cat` is a subt
5353
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
5454

5555
```scala
56-
mayAnimalBox.content = Dog("Fido")
56+
myAnimalBox.content = Dog("Fido")
5757
```
5858

5959
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

Comments
 (0)