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
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
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.
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?
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 }
Finally, I understand delegation. THANKS ALOT.
Kind of confusing syntax but explained well. Programming is getting crazy over the decades.
Excellent example, regards from Caracas, Venezuela
Amazing explanation. I never thought how easy it is.
Excellent! I finally get the idea and I love this feature ;-D
Best explanation, thanks a lot
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
Thanks a lot, such a clear explanation
you have explained very well
you explained this very beautifully
Thank you Sir
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
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.
Can't we achieve the same with extension functions ?
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?
Can you submit your version of the code?
confusing with operator fun , by the way great info
Custom implementation of the 'setValue' operator using operator overloading.
Okay I understand delegation, but what would be called as delegate in the above example?
It is delegation in the sense that you are sending validation responsibility to another class that actually validating the first and last name.
Viradar you threw Kproperty and operator keyword without explaining, I finding it difficult to follow this way
Loved it!
How I want check varriavble value is even only using a single variable not a class
This can be done easily by using Extension functions.
thanks man!
I didn't understand the property thing please someone explain
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
}
Still the delegation is more concise as you can clearly see.
Hi sir , how to crack technical round android interviews 😢
Suppose if they ask either API calling or something like that?? I am new...
you can say i am fresher and learning these topics or better to learn these topics in this channel.
@@ss-xn5rw thank you...😊😊
Good content
a