HP Fortran Programmer's Reference (September 2007)

HP Fortran statements
TYPE (definition)
Chapter 10484
TYPE (definition)
The first statement of a derived type definition.
Syntax
TYPE [[,
access-spec
] ::]
derived-type-name
access-spec
is the keyword PUBLIC or PRIVATE.
derived-type-name
is a legal Fortran 90 name.
Description
The TYPE statement introduces the definition of a derived type. A derived type name may be
any legal Fortran 90 name, as long as it is not the same as an intrinsic type name or another
local name (except component names and actual argument keyword names) in that scoping
unit.
A derived type may contain an access specification (PUBLIC or PRIVATE attribute) or an
internal PRIVATE statement only if it is in a module.
Examples
! This is a simple example of a derived type
! with two components, high and low.
TYPE temp_range
INTEGER high, low
END TYPE temp_range
! This type uses the previous definition for one of its
! components
TYPE temp_record
CHARACTER(LEN=40) city
TYPE (temp_range) extremes(1950:2050)
END TYPE temp_record
! This type has a pointer component to provide links to other
! objects of the same type, thus providing linked lists.
TYPE linked_list
REAL value
TYPE(linked_list),POINTER :: next
END TYPE linked_list
! This is a public type whose components are private; defined