Advertisement
Guest User

Untitled

a guest
May 20th, 2019
105
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. fun haveFun(person: Person<Parent>) {
  2. //Everyone can have fun!
  3. }
  4.  
  5. // Usage:
  6. fun main(args: Array<String>) {
  7. // This will work. It's an supertype of `Parent`.
  8. haveFun(Person<GrandParent>())
  9.  
  10. // This will work. It's an exact type.
  11. haveFun(Person<Parent>())
  12.  
  13. // This will work. It's a subtype of `Parent`
  14. haveFun(Person<BabyChild>())
  15. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement