The super keyword

The super keyword is used to call the functions of the parent class. In the following example, we call the displayInfo() function from the Student class by using the super keyword:

override fun displayInfo() {
super.displayInfo()
println("I am a student of $education in $institutionName and
my ID is
$studentID")
}

Notice that by calling the parent class, the function in the child class displays the same output as before.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.221.163.13