132. Unlimited polymorphic allocatable variable can be set to any type.#
topic: Generic programming
Note
This tip is a draft1.
An unlimited polymorphic allocatable variable x
class(*), allocatable :: x
can hold any type of variable or object. It can be passed as a class(*) argument. Otherwise it must be disambiguated with SELECT TYPE before being used.
An unlimited polymorphic allocatable variable x
— FortranTip (@fortrantip) February 23, 2022
class(*), allocatable :: x
can hold any type of variable or object. It can be passed as a class(*) argument. Otherwise it must be disambiguated with SELECT TYPE before being used.pic.twitter.com/gYj2OMhwQj
- 1
From the perspective of FortranTip Browser, “draft” means that it hasn’t been edited for formatting, hasn’t had corresponding Fortran programs added, the text content hasn’t been enhanced, etc. Draft texts are extracted from the corresponding Tweet using the Twitter API.