Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type Variance Exercise #90

Open
blogscot opened this issue Jun 20, 2017 · 0 comments
Open

Type Variance Exercise #90

blogscot opened this issue Jun 20, 2017 · 0 comments

Comments

@blogscot
Copy link

The original AboutTypeVariance koan defined the following class hierarchy:

  class Fruit
  abstract class Citrus extends Fruit
  class Orange extends Citrus
  class Tangelo extends Citrus
  class Apple extends Fruit
  class Banana extends Fruit

I feel, adding this information to the type variance exercise would help readers fully understand the examples. Namely, in the following contravariance example, it is important to know that Citrus is a superclass of both Orange and Tangelo.

val orangeBasket: MyContainer[Orange] =  new MyContainer[Citrus](new Tangelo)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant