Run ❯
Get your
own
website
×
Change Orientation
Change Theme, Dark/Light
Go to Spaces
// Superclass open class MyParentClass { val x = 5 } // Subclass class MyChildClass: MyParentClass() { fun myFunction() { println(x) // x is defined in the superclass } } // Create an object of the MyChildClass and call myFunction fun main() { val myObj = MyChildClass() myObj.myFunction() }
5