Declared Element Characteristics
Estimated reading time: 2 minutes
Every declared element (a programming element that is defined in a declaration statement) has one or more of the following characteristics associated with it:
- Data type - (
Type
keyword) The values the element can hold, and how those values are stored, such as*BINARY, *BOOLEAN, *BYTE, *CHAR, *DATE, *DECIMAL | *FLOAT, *IND, *INTEGER, *OBJECT, *ONECHAR, *PACKED, *STRING, *TIME, *TIMESTAMP
, or*ZONED
. - Lifetime - (
Static
keyword) The period the declared field will remain in existence and retain their latest values after termination of the procedure in which they are declared. - Scope - (
Access
keyword) The type of access to the member, such as*PRIVATE, *PUBLIC, *PROTECTED
, or*INTERNAL
. - Accessibility (
Shared
keyword) The permission for code to use the element.
The following table shows the declared elements and the characteristics that apply to each one.
Element |
Data type (```Type```) |
Lifetime (```Static```) |
Scope (```Access```) |
Accessibility (```Shared```) |
---|---|---|---|---|
Class | No | No | Yes | Yes |
Constant | Yes | No | Yes | Yes |
Enumeration | Yes | No | Yes | Yes |
Event | No | No | Yes | Yes |
Property | Yes | No | Yes | Yes |
Method | No | No | Yes | Yes |
Procedure | No | No | Yes | Yes |
Function return | Yes | Yes | Yes | No |
Delegate | No | No | Yes | Yes |
Interface | No | No | Yes | Yes |
Variable | Yes | Yes | Yes | Yes |
Visibility
Visibility results from a combination of lifetime, scope, and accessibility. a programming element can be said to be visible from a block of code when all three of the following conditions apply:
- The element is within its lifetime ( Static ) — that is, it has been created and not yet terminated.
- The access of the element includes the block of code referring to it.
- The element’s sharing accessibility permits the code to use it.
Related Sections
Describes the lifetime of a declared element.
Describes the scope of access of a declared element.
Declared Element Accessibility
Describes the accessibility of a declared element.