Kotlin Delegating Properties Tutorial with Example

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

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

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

    Finally, I understand delegation. THANKS ALOT.

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

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

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

    Excellent example, regards from Caracas, Venezuela

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

    Amazing explanation. I never thought how easy it is.

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

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

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

    Best explanation, thanks a lot

  • @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

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

    Thanks a lot, such a clear explanation

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

    you have explained very well

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

    you explained this very beautifully

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

    Thank you Sir

  • @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

  • @bharath7730
    @bharath7730 9 месяцев назад

    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.

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

    Can't we achieve the same with extension functions ?

  • @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?

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

    confusing with operator fun , by the way great info

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

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

  • @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.

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

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

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

    Loved it!

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

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

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

    This can be done easily by using Extension functions.

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

    thanks man!

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

    I didn't understand the property thing please someone explain

  • @avishekthapa6655
    @avishekthapa6655 3 года назад +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  3 года назад +2

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

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

    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 3 года назад +1

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

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

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

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

    Good content

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

    a