Abstract objects can have multiple implementations. Fortran does not offer a direct solution to declare them as an array. However, it is still possible to handle it. Check below how to do it: Abstract type: Several implementations: and Declare a dynamic array of concrete objects: Declare a dynamic array of the abstract type shapes: First,…
read more
by lincador
306
An abstract class is defined with the keyword abstract. It tells the class it cannot be instantiated. On the other hand, it can be used as shared behavior between related classes. That’s when a subclass is created by referring its parent. How to define an abstract class: Note two procedures are defined: getSpecies implementation is…
read moreDeferred procedures are those functions/subroutines that will be later implemented in a specific derived type. For instance, It can only be declared on abstract derived types. To illustrate it, our problem requires a generic class that enforces the equal (==) property. Fortran classes must implement/overload the generic ‘==’ so it is possible to compare them.…
read more