02.07.2013 Views

HP Fortran Programmer's Reference

HP Fortran Programmer's Reference

HP Fortran Programmer's Reference

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>HP</strong> <strong>Fortran</strong> statements<br />

PRIVATE (statement and attribute)<br />

Description<br />

The PRIVATE attribute may appear only in the specification part of a module. The default<br />

accessibility in a module is PUBLIC; it can be changed to PRIVATE using a statement without a<br />

list. However, only one PRIVATE accessibility statement without a list is permitted in a<br />

module.<br />

The PRIVATE attribute in a type statement or in an accessibility statement restricts the<br />

accessibility of entities such as module variables, type definitions, functions, and named<br />

constants. USE statements may restrict accessibility further.<br />

A derived type may contain a PRIVATE attribute or an internal PRIVATE statement, if it is<br />

defined in a module. The internal PRIVATE statement in a type definition makes the<br />

components unavailable outside the module even though the type itself might be available.<br />

The PRIVATE statement may also be used to restrict access to subroutines, generic specifiers,<br />

and namelist groups.<br />

The PRIVATE specification for a generic name, operator, or assignment does not apply to any<br />

specific name unless the specific name is the same as the generic name.<br />

Examples<br />

MODULE fourier<br />

REAL :: x, y, z ! PUBLIC (default)<br />

COMPLEX, PRIVATE :: fft ! PRIVATE, accessible only in module<br />

TYPE (structure_name), PRIVATE :: structure_a, structure_b<br />

! a, b and c are accessible only within this module<br />

PRIVATE a, b, c<br />

! r, s, and t are accessible outside the module<br />

PUBLIC r, s, t<br />

END MODULE fourier<br />

MODULE place<br />

PRIVATE ! Change default accessibility to PRIVATE<br />

INTERFACE OPERATOR (.st.)<br />

MODULE PROCEDURE xst<br />

END INTERFACE<br />

! make .st. public; everything else is private<br />

PUBLIC OPERATOR (.st.)<br />

LOGICAL, DIMENSION (100) :: lt<br />

CHARACTER(20) :: name<br />

INTEGER ix, iy<br />

END MODULE place<br />

Related statements<br />

PUBLIC and USE<br />

400<br />

Chapter 10

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!