VMS Help  —  FORTRAN  Data  Derived Types, Constructors  Examples
  Consider the following derived-type definition:

    TYPE EMPLOYEE
      INTEGER ID
      CHARACTER(LEN=40) NAME
    END TYPE EMPLOYEE

  This can be used to produce the following structure constructor:

    EMPLOYEE(3472, "John Doe")

  The following example shows a type with a component of derived
  type:

    TYPE ITEM
      REAL COST
      CHARACTER(LEN=30) SUPPLIER
      CHARACTER(LEN=20) ITEM_NAME
    END TYPE ITEM

    TYPE PRODUCE
      REAL MARKUP
      TYPE(ITEM) FRUIT
    END TYPE PRODUCE

  In this case, you must use an embedded structure constructor to
  specify the values of that component; for example:

    PRODUCE(.70, ITEM (.25, "Daniels", "apple"))
Close Help