I have 2 Mongo collections that correspond to the following data classes: ArcadeSessions, ArcadeMarioSessions
data class PlayingSession(
    val sessionId: Int
    val sessionDescription: String
    val game: Game // Mario, GTA, ...
)
data class MarioPlayingSession(
    val numberOfJumps : Int
    val totalMarioScore: Int
    val level: MarioLevel
) : PlayingSession(...)
data class ArcadeSessions(
    val id: Int, // player ID
    val sessionHistory: List<PlayingSession>?
)
data class ArcadeMarioSessions(
    val id: Int, // player ID
    val sessionHistory: List<MarioPlayingSession>?
)
As you can see ArcadeMarioSessions basically contains a subset of ArcadeSessions for each player (let's not get into the "why").
It feels like a crime against humanity to write it like that (like completely different classes) But for some reason, I can't get the data classes to play well with inheritance.
What is the correct way to write such a thing?
 
                        
If you can't use inheritance, use composition:
But checking whether the instances of
MarioPlayingSessionconformsPlayingSessionwill return false. A bit cumbersome workaround for this is:Now both
MarioPlayingSessionImplandPlayingSessionImplmay be put intoList<PlayingSession>