Try OpenEdge Now
skip to main content
Object-oriented Programming
Programming with Class-based Objects : Verifying the type and validity of an object reference : TYPE-OF function
 

TYPE-OF function

TYPE-OF is a built-in LOGICAL function that verifies that a specified object reference points to an object that is defined as a specified class, inherits from a specified class, or implements a specified interface.
This is the syntax for the TYPE-OF function:

Syntax

TYPE-OF (object-reference, object-type-name)
Element descriptions for this syntax diagram follow:
object-reference
An object reference to any class or interface type.
object-type-name
The type name of a class or interface. This can be the fully qualified object type name or the unqualified class or interface name, depending on the presence of an appropriate USING statement in the class or procedure file. For more information on object type names, see Defining and referencing object type names. For more information on the USING statement, see Referencing an object type name without its package.
The function verifies that the object referenced by the specified object-reference satisfies one of the following conditions:
1. Matches the class or interface type specified by object-type-name
2. Is a subclass of the class type specified by object-type-name
3. Implements the interface type specified by object-type-name
If any of these conditions are valid, this function returns TRUE. If none are valid, this function returns FALSE. If object-reference does not point to a valid object (see the ), the TYPE-OF function returns the Unknown value (?).