Need help in this scenario, Clone a Derived Instance from a Base Object
open class Player(override val playerName: String, override val id: Int) : FantasyPlayer
data class TeamPlayer(
override val playerName: String,
override val id: Int,
val teamId: Int,
val isCaptain: Boolean = false,
val isSelected: Boolean = false
) : Player(playerName, id)
So, I have a player object and I want to create instance of another class which is actually extended from the base
and I want to copy all the property values to this extended class, is this the correct approach or is it even possible\. For example,
val player = Player("Beckham", 1, 1)
val teamPlayer = TeamPlayer(// player, 10, true, true)