OB Instance of
OB Instance of ( object ; class ) : Boolean
Parameter | Type | Description | |
---|---|---|---|
object | Object | → | Object whose class is to be tested |
class | Object | → | Class to test belongship |
Function result | Boolean | ← | 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
Properties
Command number | 1731 |
Thread safe | ✓ |