Created
May 14, 2017 22:07
-
-
Save koher/2a5a817e1528e72549c45e1fbe06f553 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
open class Animal | |
class Cat: Animal() | |
class Box<out Value> ( // `out` for covariance | |
val value: Value | |
) | |
fun main(args: Array<String>) { | |
val catBox: Box<Cat> = Box(Cat()) | |
val animalBox: Box<Animal> = catBox // OK | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment