PropertyCopy from one object to another in kotlin
To copy properties from one object to another in Kotlin, you can use the copy
function along with the spread operator. Here's how you can do it:
data class Person(val name: String, val age: Int)
fun main() {
val person1 = Person("Alice", 25)
val person2 = person1.copy()
println(person2) // Output: Person(name=Alice, age=25)
}