Skip to main content
Version: 21 R3

OB Instance of

OB Instance of ( object : Object ; class : Object ) : Boolean

ParameterTypeDescription
objectObject→Object whose class is to be tested
classObject→Class to test belongship
Function resultBoolean←True if object belongs to the specified class or a child class, and false otherwise
History
ReleaseChanges
18 R3Created

Description​

The OB Instance of command returns true if object belongs to class or to one of its child classes, and false otherwise.

If class is not a valid Class object, the error -10745 is returned.

Example​

You created the Polygon class:

  //Class: Polygon
Class constructor($width : Integer; $height : Integer)
This.area:=$width*$height

Then, in a method, you can write:

 var $poly : Object
 var $instance : Boolean
 
 $poly:=cs.Polygon.new(4;3)
 
 $instance:=OB Instance of($poly;cs.Polygon)
  // true
 
 $instance:=OB Instance of($poly;4D.Object)
  // true 
 
 $instance:=OB Instance of($poly;cs.Circle)
  // false

See also​

OB Class

Properties​

Command number1731
Thread safeyes