When working with classes and in particular with extended types in Fortran 2003/8: is there any analog of python's super() function that can be used to call a method from the extending type which has been overridden in the extended type?
The super() function is used to give access to methods and properties of a parent or sibling class. The super() function returns an object that represents the parent class.
Understanding Python super() with __init__() methodsThe super function returns a temporary object of the superclass that allows access to all of its methods to its child class. Note: For more information, refer to Inheritance in Python.
In general it is necessary. And it's often necessary for it to be the first call in your init. It first calls the init function of the parent class ( dict ).
Super() to Call Super Class Constructor Here, the derived class Newdemo calls the super() with arguments a, b, and c. This causes the constructor __init__ of the base class, i.e. Demo to be called. This initialises the values of a, b, and c. Hence, the Newdemo class no longer initialises the values itself.
Yes, if the parent type is not abstract.
CALL object%ParentType%Binding(...)
Otherwise you can always just call the specific procedure that implements the binding in the parent.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With