LF Fortran 95

PRIVATE Statement

Description

The PRIVATE statement specifies that the names of entities are accessible only within the current module.

Syntax

PRIVATE [[::] access-ids]
Where:

access-ids is a comma-separated list of use-name or generic-spec

use-name is any name within the scope of the module in which the PRIVATE statement appears.

generic-spec is generic-name or OPERATOR (defined-operator) or ASSIGNMENT (=)

generic-name is the name of a generic procedure.

defined-operator is one of the intrinsic operators or .op-name.

.op-name. is a user-defined name for the operation

Remarks

The PRIVATE statement is permitted only in a module.

If the PRIVATE statement appears without a list of objects, it sets the default accessibility of named items in the module to private; otherwise, it makes the accessibility of the listed objects private.

If the PRIVATE statement appears in a derived type definition, the entities within the derived type definition are accessible only in the current module. Within a derived type definition, the PRIVATE statement cannot have an object list.

Example

module ex implicit none ! default accessibility is public real :: a,b private a ! a is not accessible outside module ! b is accessible outside module real,private :: c ! private attribute type zee private integer :: l,m ! zee, l and m are private end type zee end module ex