HELP I keep getting a reference error trying to call the data class
copy
Corey Lanier
10/14/2020, 4:52 AM
These are also the only options given to me for
copy
on import so i don’t know what to do at all
m
Milan Hruban
10/14/2020, 5:32 AM
Can you share the code snippet? Data class copy is a member function, not a top level function, so you should call it on the data class instance with a dot notation
Copy code
data class A(val a: Int)
val foo = A(1)
val bar = foo.copy()
c
Corey Lanier
10/14/2020, 11:03 PM
Thanks, yeah, you were right that I had missed putting it inside a data class