|
- Understanding Python super() with __init__() methods
super() lets you avoid referring to the base class explicitly, which can be nice But the main advantage comes with multiple inheritance, where all sorts of fun stuff can happen
- How does Pythons super () work with multiple inheritance?
In fact, multiple inheritance is the only case where super() is of any use I would not recommend using it with classes using linear inheritance, where it's just useless overhead
- coding style - Using super in C++ - Stack Overflow
As for chaining super::super, as I mentionned in the question, I have still to find an interesting use to that For now, I only see it as a hack, but it was worth mentioning, if only for the differences with Java (where you can't chain "super")
- java - When do I use super ()? - Stack Overflow
I'm currently learning about class inheritance in my Java course and I don't understand when to use the super() call? Edit: I found this example of code where super variable is used: class A {
- Python: super object has no attribute attribute_name
After the base class's __init__ ran, the derived object has the attributes set there (e g some_var) as it's the very same object as the self in the derived class' __init__ You can and should just use self some_var everywhere super is for accessing stuff from base classes, but instance variables are (as the name says) part of an instance, not part of that instance's class
- Difference between lt;? super T gt; and lt;? extends T gt; in Java
What is the difference between List<? super T> and List<? extends T> ? I used to use List<? extends T>, but it does not allow me to add elements to it list add (e), whereas the Li
- Java Inheritance - calling superclass method - Stack Overflow
Additional info: super alphaMethod1(); can't be called from main method This answer doesn't state it, but this call needs to be made from somewhere within non-static context of subclass: beta
- How do I initialize the base (super) class? - Stack Overflow
wrong super only works with new-style classes, and is the only proper way to call a base when using new-style classes Furthermore, you also need to pass 'self' explicitly using the old-style construct
|
|
|