HELP I keep getting a reference error trying to ca...
# announcements
c
HELP I keep getting a reference error trying to call the data class
copy
These are also the only options given to me for
copy
on import so i don’t know what to do at all
m
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
Thanks, yeah, you were right that I had missed putting it inside a data class
And it’s working fine now