Visible to Intel only — GUID: GUID-34115DC4-E213-4314-A59C-8F489B58620E
Visible to Intel only — GUID: GUID-34115DC4-E213-4314-A59C-8F489B58620E
CLASS
Statement: Declares a polymorphic object. It takes one of the following forms:
CLASS (name) att-list :: v-list
CLASS (*) att-list :: v-list
name |
Is the name of the extensible derived data type. |
att-list |
Is one or more attribute specifiers. These are the same attribute specifiers allowed for a derived-type TYPE statement. |
v-list |
Is the name of one or more data objects or functions. The name can optionally be followed by any of the following:
|
A polymorphic object can have differing types during program execution.
The type of the object at a particular point during execution of a program is its dynamic type.
The declared type of a data entity is the type that it is declared to have, either explicitly or implicitly.
If CLASS (*) is specified, it denotes an unlimited polymorphic object. An unlimited polymorphic entity is not declared to have a type. It is not considered to have the same declared type as any other entity, including another unlimited polymorphic entity.
An entity declared with the CLASS keyword must be a dummy argument or have the ALLOCATABLE or POINTER attribute.
A polymorphic entity that is not an unlimited polymorphic entity is type compatible with entities of the same declared type or any of its extensions. Even though an unlimited polymorphic entity is not considered to have a declared type, it is type compatible with all entities. An entity is said to be type compatible with a type if it is type compatible with entities of that type.
A polymorphic allocatable object can be allocated to be of any type with which it is type compatible.
During program execution, a polymorphic pointer or dummy argument can be associated with objects with which it is type compatible.