Skip to content

Instantly share code, notes, and snippets.

@ezura
Last active June 24, 2017 04:44
Show Gist options
  • Select an option

  • Save ezura/2d8c733c0355394fc2fc9526f7e4f5cb to your computer and use it in GitHub Desktop.

Select an option

Save ezura/2d8c733c0355394fc2fc9526f7e4f5cb to your computer and use it in GitHub Desktop.
p.163
class B<out Any> {}
val b: B<String> = B()
val b_: B<out Any> = b // out あり
b_
// B@5327a06e
val b: B<String> = B()
val b_: B<Any> = b // out なし
b_
// B@31c2affc
@ezura
Copy link
Copy Markdown
Author

ezura commented Jun 24, 2017

上と下、同じに見える。使う側で out 指定する必要あるのか。ありなしでどういう違いがあるのか。(class とか func 宣言時に指定するなら意味があるのわかる)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment