インテル® Fortran コンパイラー 19.0 デベロッパー・ガイドおよびリファレンス

GENERIC

Statement: Declares a generic interface that is bound to a derived type-bound procedure. It takes the following form:

GENERIC [, access-spec]:: generic-spec => binding-name1 [, binding-name2]...

access-spec

(Optional) Is the PUBLIC or PRIVATE attribute. Only one can be specified.

generic-spec

Is an explicit INTERFACE statement using one of the following:

The same generic-spec can be used in several generic bindings within a single derived-type definition. In this case, every occurrence of the same generic-spec must have the same accessibility.

binding-spec1, binding-spec2,...

Is the name of the type-bound procedure. Each specific binding-name must have the passed-object dummy argument.

Example

Consider the following:


TYPE MY_TYPE2
...   
CONTAINS
  PROCEDURE :: MYPROC => MYPROC1
  PROCEDURE,PASS(C) :: UPROC => UPROC1
  GENERIC :: OPERATOR(+) => MYPROC, UPROC
END TYPE MY_TYPE2
...
TYPE,EXTENDS(MY_TYPE2) :: MY_TYPE3
...
CONTAINS
  PROCEDURE :: MYPROC => MYPROC2
  PROCEDURE,PASS(C) :: UPROC => UPROC2
END TYPE MY_TYPE3

The type MY_TYPE3 inherits the generic operator '+'. Invoking the generic (+) invokes the specific type-bound procedure. For entities of type MY_TYPE3, that invokes the overriding actual procedure (MYPROC2 or UPROC2).

See Also