ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / OOP (Object Oriented Programming)
  • Example
  • Remark
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
The is <Class> operator is used to find out whether the object used is an object of the class (or an object of one of its derived classes).
Syntax
<Result> = <Object> is <Class>
<Result>: Boolean
  • True if the object used is an object of the class (or an object of one of its derived classes),
  • False otherwise.
<Object>: Class object
Name of the object whose test must be run. This object can be a dynamic object or not.
<Class>: Class
Class name. The object can belong (or not) to this class.
Remarks

Example

Four classes are used in this example:
  • BaseClass1
  • BaseClass2
  • DerivedClase that derives from BaseClass1
  • DoubleDerivedClase that derives from BaseClass1 and from BaseClass2
The following code is used to check whether the object belongs to the different classes.
Result1 is boolean
Object1 is dynamic BaseClass1 object
 
Object1 = new BaseClass1
Result1 = Object1 is BaseClass1 // Result1 contains "True"
Result1 = Object1 is BaseClass2 // Result1 contains "False"
Result1 = Object1 is DerivedClass // Result1 contains "False"
Result1 = Object1 is DoubleDerivedClass // Result1 contains "False"
 
Object1 = new DerivedClass
Result1 = Object1 is BaseClass1 // Result1 contains "True"
Result1 = Object1 is BaseClass2 // Result1 contains "False"
Result1 = Object1 is DerivedClass // Result1 contains "True"
Result1 = Object1 is DoubleDerivedClass // Result1 contains "False"
 
Object1 = new DoubleDerivedClass
Result1 = Object1 is BaseClass1 // Result1 contains "True"
Result1 = Object1 is BaseClass2 // Result1 contains "True"
Result1 = Object1 is DerivedClass // Result1 contains "False"
Result1 = Object1 is DoubleDerivedClass // Result1 contains "True"

Remark

The Class property is used to get the actual type of the class instance used by a variable of type object, dynamic object or variant.
Minimum version required
  • Version 16
This page is also available for…
Comments
Click [Add] to post a comment

Last update: 05/26/2022

Send a report | Local help