Копирование объекта

Классы

class Shape(val lineCount: Int, val name: String) {
    fun copy(): Shape {
        return Shape(lineCount, name)
    }
}

val square = Shape(4, "Square")

val squareCopy = square.copy()

println("lineCount is ${squareCopy.lineCount}")