In the following code, I’m trying to reuse a lot o...
# getting-started
d
In the following code, I’m trying to reuse a lot of the code from
ClassA
and only override a specific function in
ClassB
, is there anyway to do that, or do I need to ensure all of the methods require are created?
Copy code
interface View {
  fun loadFirstPage()
  fun otherFunction()
}
Copy code
open class ClassA: View {
  override fun loadFirstPage() { ... }
  override fun otherFunction() { ... }
}
Copy code
class ClassB: ClassA() {
  override fun loadFirstPage() { ... }
}
when I load
ClassB
, I’m only seeing the code from
ClassA
be executed
t
does this compile? I would expect an error in ClassB because
loadFirstPage
is not marked as
open
in ClassA. Otherwise this should work just fine