ISO2002MF 

The Class-ID Paragraph

The Class-ID paragraph indicates that this Identification Division is introducing a class definition and specifies the name that identifies the class and assigns class attributes to the class.

General Format

Class-ID

Directives

  1. In addition to the Compiler directives which provide flagging and modify the reserved word list, the following directives may impact either the syntax or the semantics described in this section.
    • ACTUAL-PARAMS - specifies the parameters to be used in the creation of a class from a parameterized class or interface.
    • ILSOURCE - specifies a file that contains another program to form part of the current .NET assembly. This may include further components of a partial class .

Syntax Rules

  1. Literal-1 must be an alphanumeric literal and must not be a figurative constant.
  2. Type-specifier-1 must not be the name of the class declared by this class definition.
  3. Type-specifier-1 must not inherit from class-name-1 directly or indirectly.
  4. Type-specifier-1 must not be the name of a class defined with the FINAL clause.
  5. Type-specifier-1 cannot be repeated when you compile a program for .NET. In other words, multiple inheritance is not allowed.
  6. Type-specifier-2 must not refer to the interface.
  7. A given class name must not appear more than once in an INHERITS clause.
  8. If two or more different methods with the same name are inherited, none of them may be specified with the FINAL clause. If the same method is inherited from one superclass through two or more intermediate superclasses, it may be specified with the FINAL clause.
  9. If a given method-name is inherited from more than one inherited class, then, if the prototypes for these methods are such that to define a method with the same interface as any one of them in this class would prevent this class from conforming to all the inherited classes, then a method with the same method-name must be declared in this class. This method must satisfy syntax rule 9 in the topic The Method-ID Paragraph.
    Note: If class A inherits method M from two classes, B and C, and the method interface for M is not identical in classes B and C (say M in B returns an object of class X, and M in C returns an object of an unrelated class Y), then the inheritance is invalid, unless a valid method override of M is defined in class A that resolves the method interface conformance problem. It is not always possible to do so (in which case the inheritance is not valid), but there are some cases in which it can be done. For example, if it is possible to define Z as a class that inherits X and Y, then a method override for M could be specified in class A, returning an object of class Z.
  10. Parameter-name-1 must be a name specified in a class-specifier or an interface-specifier in the Repository paragraph of this class definition.
  11. NETJVM Attribute-clause is defined in the topic on the Attribute, Custom-Attribute Clause.

General Rules

  1. Class-name-1 names the class declared by this class definition. However, literal-1, if specified, is the name of the class that is externalized to the operating environment.
  2. The INHERITS clause specifies the name of the class that is inherited by class-name-1 according to Class inheritance.
  3. If the FINAL clause is specified, the class must not be the superclass for any other class.
  4. NETJVM The PARTIAL phrase specifies that this is a partial class that may be combined with one or more other partial classes with the same externalized name to form a single combined class. This may be combined using the ILSOURCE directive.
  5. NETJVM The USING phrase specifies that this is a parameterized class. Parameter-name-1 is the name given to the formal parameter. See the topic Parameterized Classes in the chapter Language Fundamentals for details of the behavior of a parameterized class.

    When USING is specified for a class that is being compiled for .NET, the resulting class is known as a generic class. Constraints for the parameters may be specified in the Constraints paragraph.

  6. Parameter-name-1 must be specified within this class definition only where a class-name or an interface-name is permitted.
  7. If the same class is inherited more than once, then only one copy of the data for that class is added to class-name-1.
    Note: While the same class cannot be directly inherited more than once, a class may be indirectly inherited multiple times. For example, suppose class D inherits from classes B and C, and classes B and C both inherit from class A. In this example, class D indirectly inherits class A twice, once as a superclass of B, and once as a superclass of C.
  8. NETJVM  If STATIC is specified, all methods in a class are static.