Kotlin Delegating Properties Tutorial with Example

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

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

  • @RCMOULI1
    @RCMOULI1 3 года назад +11

    Kind of confusing syntax but explained well. Programming is getting crazy over the decades.

  • @ahmednabil5119
    @ahmednabil5119 3 года назад +2

    Finally, I understand delegation. THANKS ALOT.

  • @Talhaguy
    @Talhaguy Месяц назад +1

    Beautifully explained, thanks!

  • @VenewebTV
    @VenewebTV 2 года назад

    Excellent example, regards from Caracas, Venezuela

  • @udaysharma5228
    @udaysharma5228 2 года назад

    Amazing explanation. I never thought how easy it is.

  • @this-is-bioman
    @this-is-bioman 3 года назад +1

    Excellent! I finally get the idea and I love this feature ;-D

  • @lucycat-p2l
    @lucycat-p2l 2 года назад

    Best explanation, thanks a lot

  • @zet_indexx10
    @zet_indexx10 Месяц назад

    We can also use "data class" for printing the class :)

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

    you have explained very well

  • @bharathanddata
    @bharathanddata 11 месяцев назад

    is NameDelegate object created for each property or there is only one object for every property. Because if it create objects for each property then it may be inefficient.

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

    Thanks a lot, such a clear explanation

  • @emanalsbeiheen5619
    @emanalsbeiheen5619 3 года назад +1

    Hi belal... Can you please make just one more video on reflection in kotlin and add it to this list,,,, I need to fully understand Reflection,, you are amazing teacher thank you

  • @namrathabharadwaj8945
    @namrathabharadwaj8945 2 года назад

    Hey Belal. How is this delegation any different than creating a common private method to avoid redundant code? I mean what is the significance of delegation over creating a common method in this case?

  • @jasdevsingh6795
    @jasdevsingh6795 Год назад

    Can't we achieve the same with extension functions ?

  • @ss-xn5rw
    @ss-xn5rw 4 года назад

    you explained this very beautifully

  • @oparvind
    @oparvind 4 года назад +1

    Thank you Sir

  • @junigates
    @junigates 2 года назад

    confusing with operator fun , by the way great info

    • @vidyesh
      @vidyesh 2 года назад

      Custom implementation of the 'setValue' operator using operator overloading.

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

    Hi
    Have one doubt
    I try to re assign some different value (which is below range of 5) in student's firstName and lastName but it cannot assign again
    In output, it shows old value

  • @ravipratapsingh3428
    @ravipratapsingh3428 2 года назад

    How I want check varriavble value is even only using a single variable not a class

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

    Loved it!

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

    Okay I understand delegation, but what would be called as delegate in the above example?

    • @deepakbisht4957
      @deepakbisht4957 2 года назад

      It is delegation in the sense that you are sending validation responsibility to another class that actually validating the first and last name.

  • @Saranshhanda
    @Saranshhanda 4 года назад

    thanks man!

  • @master8994
    @master8994 2 года назад

    I didn't understand the property thing please someone explain

  • @shashankrana977
    @shashankrana977 2 года назад

    Viradar you threw Kproperty and operator keyword without explaining, I finding it difficult to follow this way

  • @avishekthapa6655
    @avishekthapa6655 4 года назад +1

    cant we just create a function that does the validation and used that validation in setter and getter like this
    class Student {
    var firstName: String? = null
    set(value) {
    if (isValid(value))
    field = value?.trim()?.toUpperCase()
    }
    var secondName: String? = null
    set(value) {
    if (isValid(value))
    field = value?.trim()?.toUpperCase()
    }
    private fun isValid(data: String?) = data != null && data.length > 5
    }

    • @SimplifiedCoding
      @SimplifiedCoding  4 года назад +2

      Still the delegation is more concise as you can clearly see.

  • @praveennp4108
    @praveennp4108 4 года назад

    Hi sir , how to crack technical round android interviews 😢
    Suppose if they ask either API calling or something like that?? I am new...

    • @ss-xn5rw
      @ss-xn5rw 4 года назад +1

      you can say i am fresher and learning these topics or better to learn these topics in this channel.

    • @praveennp4108
      @praveennp4108 4 года назад +1

      @@ss-xn5rw thank you...😊😊

  • @amitrajj
    @amitrajj 2 года назад

    This can be done easily by using Extension functions.

  • @hanamanth_vlogs6565
    @hanamanth_vlogs6565 4 года назад

    Good content

  • @gibraanjafar1669
    @gibraanjafar1669 4 года назад

    a