How to use Multiple Constructors in a Kotlin Class

Поделиться
HTML-код
  • Опубликовано: 18 ноя 2024

Комментарии • 8

  • @Cablur
    @Cablur 11 дней назад +1

    You have some really nice videos. I love how concise and on-point you explain, but still beginner friendly-ish

    • @donnfelkeryt
      @donnfelkeryt  11 дней назад

      @@Cablur thank you! Glad they’ve been helpful for you!

  • @aishwaryapravatnalini1999
    @aishwaryapravatnalini1999 3 года назад +3

    Wow... this is amazing...thank you so much for this thorough and detailed video , it provided me with a lot of clarity and deep insights into constructors!

  • @swaminathbera6407
    @swaminathbera6407 2 года назад +2

    Clear

  • @juancho31
    @juancho31 3 года назад

    Thank you so much, Donn! but what happens if the main constructor has only one param and I need to add another constructor which has more params? Thanks again

  • @TheMyth2.9
    @TheMyth2.9 2 года назад +1

    Great tutorial, but I don't like how Kotlin have designed this, this means, there can't be any proper constructor overloading, if we have to call the "primary constructor", this is one aspect that I think is far better in Java.
    What if we don't want to have those default values? What if we want one constructor that takes no arguments? What would be the best workaround for this?

  • @tree12341
    @tree12341 3 года назад

    Hello this is a great video! How would you do this for a child class where the parent has multiple constructors, but the child also has multiple constructors. How would a child be able to call different super() methods depending on the constructor?