Skip to main content
Version: Next

OB Instance of

OB Instance of ( object ; class ) -> Function result

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

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
 var $1;$2 : Integer
 This.area:=$1*$2

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