We have a program where the classes Person and Teacher are defined. Within the main(), an instance of the Teacher class is created. Put the program lines in the correct order using indentation (4 spaces).
Inheritance and constructors
Code order and indentation
Report a typo
Reorder lines using drag or arrows. Adjust indentation with left buttons
constructor(name: String, age: Int): super(name, age)
}
fun main() {
class Teacher : Person {
val person = Teacher("My Name", 30)
open class Person(val name: String, val age: Int, profession: String = "")
}
___
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.
Create a free account to access the full topic
By continuing, you agree to the JetBrains Academy Terms of Service as well as Hyperskill Terms of Service and Privacy Policy.