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
interfaceNamed {
val name:String
}
interfacePerson: Named {
val firstName:Stringval lastName:Stringoverrideval name:String get() ="$firstName$lastName"
}
data classEmployee(
//implementing name is not required because there is an implementation in Person interfaceoverridevalfirstName:String,
overridevallastName:String,
valposition:Position
): Person
interfaceA {
funfoo() { print("A foo") }
//bar is not marked abstract because that's implicit within//an interface declaration if the function has no body.funbar()
}
interfaceB {
funfoo() { print("B foo") }
funbar() { print("B bar") }
}
classC : A {
//we must override baroverridefunbar() { print("bar") }
}
//we must override all methods that are common in multiple interfaces and //specify exactly how the super implementations should be calledclassD : A, B {
overridefunfoo() {
super<A>.foo()
super<B>.foo()
}
overridefunbar() {
super<B>.bar()
}
}