+ 2
How can we call first base class in multilevel inheritance
In oop, for eg class A is inherited to class B. When we make object of class B and call a function of common name then the function/ method in B will work this is called overriding. We can call base class function using SUPER keyword. My doubt is, consider if A is inherited to B and B is inherited to C and when we make object of class C how can we call method in A. If only 2 classes we can use ’super' keyword. What about 3 classes?
2 ответов
+ 2
Super of C refers to the parent B. If you want to refers to the superclass A of B , use super() in B to make a chain.
The constructor has this behavior by default.
https://code.sololearn.com/cOwny2lnoTzI/?ref=app
+ 1
I tried something..
If you add a method in C that returns super of B, you get super of A
https://code.sololearn.com/ckVoEpxBnnxe/?ref=app