Skip to content

Type Variance Exercise #90

Open
Open
@blogscot

Description

@blogscot

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions