+ 2
Why cant we use super() functions for attributes but for the inherited class?
5 Réponses
+ 3
super() calls a function of the parent class, so it won't work attributes that aren't in the parent class.
+ 1
If you override a method of the superclass, you could call super.methodName. Just so, it would be obviously senseless, but if you want to take the superclass' method and add some stuff to it, it's kind of useful. You can do stuff and call then the parent's class method.
0
Super() calls the constructor of the super class. Properties or methods do not have a super class because they belong to the class they are in.
0
The correct terminology is method. Function refers to procedural programming.
0
🤔