blob: 48724d00a9e6a6ffb22a2bb045ad956e28f918a5 [file] [log] [blame]
Roman Elizarov5459c102020-08-11 12:27:36 +03001// This file was automatically generated from polymorphism.md by Knit tool. Do not edit.
2package example.examplePoly05
3
4import kotlinx.serialization.*
5import kotlinx.serialization.json.*
6
7@Serializable
8sealed class Project {
9 abstract val name: String
10}
11
Roman Elizarov2f4d91c2021-05-17 18:53:04 +030012@Serializable
Roman Elizarov5459c102020-08-11 12:27:36 +030013class OwnedProject(override val name: String, val owner: String) : Project()
14
15fun main() {
Roman Elizarov2f4d91c2021-05-17 18:53:04 +030016 val data = OwnedProject("kotlinx.coroutines", "kotlin") // data: OwnedProject here
17 println(Json.encodeToString(data)) // Serializing data of compile-time type OwnedProject
Roman Elizarov5459c102020-08-11 12:27:36 +030018}