You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If base class and derived class contains a member function with same name, then we can override the base member function in the derived class using the override keyword and also need to mark the member function of base class with open keyword.
*/
import java.util.Arrays
open class A {
open fun demo () { // must declare open, by default function is final
println("I am from class A")
}
fun showA(){
println("I am in show A")
}
}
class B: A(){ // inheritence using default constructor
override fun demo () { // Useing override keyword to override a function from supper class