Are data classes isomorphic to structs in Swift? @2:21 The jump from pointing out that varargs aren't supported in a data class to the quote from Andrey Breslav was a bit of a leap. Isn't it enough to say varargs are arrays which live in the heap? @4:47 What are synthetic methods? It sounds like copy and copy$default both share the same semantics.
@atanasdoychinov64914 жыл бұрын
The data class sounds so good to be used for creating of models, but without the inheritance its use is so limited...
@pradeepkumarreddykondreddy70484 жыл бұрын
Is destructuring allowed only for data classes ?
4 жыл бұрын
no. any class with the methods componentN (where N is a number >= 1) can be destructured. the number of variables you use in the left hand side of the assignment must match the number of componentN methods available in that class (e.g. val (x, y, z) = obj; only works if the class of obj has component1(), component2() and component3()). the data classes get those methods generated automatically for every parameter specified in its constructor, that's why it's easier with them. but it's allowed for any class [which matches the criteria above].
@siddharthchughs1004 жыл бұрын
Hi , The videos is really good for good understanding for the data classes, but Would like to know , if we need to use the same class in the sqlite using kotlin , how to insert the data into the respective variables, as of when all the data items were kept val the sqlite was showing error and was suggesting convert the data item into the var and then was able to add all the data into the variables, therefore it was easy to show in the recyclerview using kotlin for the android application. In that case advice please, Thanks
@GemiDroid4 жыл бұрын
So great video, but I am wondering what's the benefits of making data class final?
@kolenyov4 жыл бұрын
discuss.kotlinlang.org/t/data-class-inheritance/4107/2 Inheriting a data class from another data class is not allowed because there is no way to make compiler-generated data class methods work consistently and intuitively in case of inheritance.
@GemiDroid4 жыл бұрын
@@kolenyov Thanks I got it 👍
@MaisUmSomente2 жыл бұрын
windows Ctrl +Shift+A show Kotlin Bytecode action. 02:54
@willculpepper9637 Жыл бұрын
All aboard for NotNullNovember
@mindfulnessrock Жыл бұрын
You haven't really gotten into its restriction that much, or even like real life scenario of where they fit the best, instead of of regular classes. Great anatomical explanation still!
@samuelrake78324 жыл бұрын
Whenever i remember the way data classes made me write less code when creating recyclerviews compared to java.. i sigh in relief
@RahulPahuja19914 жыл бұрын
do u mean we cannot have a parent child relationship for a data class?
@kosmozaut4 жыл бұрын
Correct and it kinda sucks
@amir328064 жыл бұрын
For some reason it compiles as a final class in Java
@farazahmed72 жыл бұрын
Inheritance should never be the first option. Kotlin strictly follows Composition over inheritance as it should be. Do read more about this and you will understand why Kotlin classes are final by default.
@febaisi14 жыл бұрын
I am still not exactly sure why Data Classes can't inherit from another Data class. ;/
@AmitJayant2 жыл бұрын
The weirdest syntax in all of Programming languages
@xpopcornx17474 жыл бұрын
again?
@gabormiklay92094 жыл бұрын
I wonder what breed of doggo Florina has... 🤔
@rayanfernandes26314 жыл бұрын
Why make data class if we can make class with data attributes
@ytechnology4 жыл бұрын
Not an expert here, but I've used data classes to hold return values from functions that return multiple values.
@kolenyov4 жыл бұрын
Benefits of the autogenerated methods like components() for destructive declaration and copy() for an immutability.