LF Fortran 95

PUBLIC Statement


The PUBLIC statement specifies that entities are accessible by use association anywhere the module that contains the PUBLIC statement is used.


PUBLIC [[::] access-ids]

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 PUBLIC 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


The PUBLIC statement is permitted only within a module.

The default accessibility of names in a module is public. If the PUBLIC statement appears without a list of objects, it confirms the default accessibility.

If a list of objects is present, the PUBLIC statement makes the objects specified accessible both within the module, and to any procedure that uses that module.


module zee implicit none private ! default accessibility is now private real :: a,b public a ! a is now accessible outside module real,public :: c ! public attribute end module zee