Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- fun haveFun(person: Person<Parent>) {
- //Everyone can have fun!
- }
- // Usage:
- fun main(args: Array<String>) {
- // This will work. It's an supertype of `Parent`.
- haveFun(Person<GrandParent>())
- // This will work. It's an exact type.
- haveFun(Person<Parent>())
- // This will work. It's a subtype of `Parent`
- haveFun(Person<BabyChild>())
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement