Derived type components

The components of a derived type can be of any intrinsic type and can be of a previously defined derived type. They can be either direct or ultimate. For more information about direct components and ultimate components, see Derived types.

A component definition statement consists of one or more type declaration statements or procedure component declaration statements to define the components of the derived type. For more information, see Type Declaration and Procedure pointer components. The type declaration statements can specify only the DIMENSION, ALLOCATABLE, PRIVATE, PUBLIC, and POINTER attributes. For details about declaring components of a specified derived type, see TYPE and CLASS (Fortran 2003).

In addition, you can specify a default initialization for each nonallocatable component in the definition of a derived type.

The type of a pointer component can be the same as the type containing the component.

A component of type character or derived type can have deferred length if the component also has the ALLOCATABLE or POINTER attribute.

Nonpointer, nonallocatable array components can be declared with either constant dimension declarators or specification expressions that can involve type parameters.
Note: You must declare pointer and allocatable array components with a deferred_shape_spec_list array specification.

A component of a derived type must not appear as an input/output list item if any ultimate component of the object cannot be accessed by the scoping unit of the input/output statement, unless a user-defined input/output procedure processes the derived-type object. A derived-type object must not appear in a data transfer statement if the object has a component that is a pointer or allocatable, unless a user-defined input/output procedure processes the object.