Advertisement
lobaev

Untitled

Mar 4th, 2022
853
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Kotlin 0.26 KB | None | 0 0
  1. fun main() {
  2.     val b = B()
  3.     val c = C()
  4.     val dcWithParameter = DC<B>(b)
  5.     val dcWithoutParameter = DC(b)
  6. }
  7.  
  8. interface A {
  9.     //...
  10. }
  11.  
  12. data class DC<T : A>(
  13.     val a: A
  14.     //...
  15. )
  16.  
  17. class B : A {
  18.     //...
  19. }
  20.  
  21. class C : A {
  22.     //...
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement