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 moreOverloading a subroutine means to redefine its internal functionality for a customized behavior. Overall it adapts the class new characteristics to already wide-spread Fortran functionalities (==, =, + ,-, …). Specifically, this post only focus on assignment (=). In the following example, Mynumber is generic class to hold any type of real number. For that…
read moreAllocatable array is a dynamic array. It’s size is not know at compilation time. Therefore it is defined at execution time by using the keyword allocate(…). It’s life scope is kept where it is defined. Once the procedure/… reaches the end it is automatically deallocated (or released). Nevertheless, you should be careful when using allocatable…
read moreA pointer in computer programming is an object that refers to a memory address. In Fortran it is declared with the keyword pointer in its declaration. Additionally its assignment is done with the => keyword. However, in order to have an array of pointers, the following form must be used: Do not fall into the…
read more