## 5.1.3 Declaration Statements for Derived Types

The derived-type (TYPE) declaration statement specifies the properties of objects and functions of derived (user-defined) type.

The derived type must be defined before you can specify objects of that type in a TYPE type declaration statement.

An object of derived type must not have the PUBLIC attribute if its type is PRIVATE.

A structure constructor specifies values for derived-type objects.

Examples

The following are examples of derived-type declaration statements:

    TYPE(EMPLOYEE) CONTRACT
    ...
    TYPE(SETS), DIMENSION(:,:), ALLOCATABLE :: SUBSET_1

The following example shows a public type with private components:

    TYPE LIST_ITEMS
      PRIVATE
      ...
      TYPE(LIST_ITEMS), POINTER :: NEXT, PREVIOUS
    END TYPE LIST_ITEMS

For More Information:

- On derived data types, see Section 3.2.
- On the general form and rules for type declaration statements, see Section 5.1.
- On use and host association, see Section 16.4.1.2.
- On the PUBLIC and PRIVATE attributes, see Section 5.16.
- On structure constructors, see Section 3.2.4.

Previous Page Next Page Table of Contents