IsInstanceOfUsual Function | |
Determine if an object inside a USUAL is an instance of a class.
Namespace:
XSharp.RT
Assembly:
XSharp.RT (in XSharp.RT.dll) Version: 2.19
Syntax FUNCTION IsInstanceOfUsual(
uObject AS USUAL,
symClassName AS STRING
) AS LOGIC
public static bool IsInstanceOfUsual(
Usual uObject,
string symClassName
)
Request Example
View SourceParameters
- uObject
- Type: Usual
A USUAL type containing the object to check for. - symClassName
- Type: String
A symbolic representation of the class.
Return Value
Type:
Logic
TRUE if
uObject is an instance of
symClassName; otherwise, FALSE.
Remarks
IsInstanceOfUsual() is used to determine whether the polymorphic value uObject belongs to a class whose symbol is symClassName.
An instance of an inherited class is also an instance of the super class. However, an instance of a super class is not an instance of any of its inherited classes.
IsInstanceOfUsual() is the same as the following: UsualType(uObject) = OBJECT .AND. IsInstanceOf(uObject, symClassName). Thus, it should be used instead of IsInstanceOf() in situations where it is not known whether a variable is an object.
IsInstanceOfUsual()() is also similar to CheckInstanceOf() except that it does not generate an error message if the specified object is not an instance of the specified class.
Examples
This example uses IsInstanceOfUsual() to check whether a USUAL variable is an object of a specific class:
1CLASS Cars
2 EXPORT Wheels
3LOCAL uMercedes
4uMercedes := Cars{}
5? IsInstanceOfUsual(uMercedes, #Cars)
See Also Reference
IsInstanceOfUsual(Usual, String)