Returns a non-zero number if the specified value is derived from the specified base object.
HasBase := HasBase(Value, BaseObj)
Any value, of any type.
Type: Object
The potential base object to test.
Type: Integer (boolean)
This function returns 1 (true) if BaseObj is in Value's chain of base objects, otherwise 0 (false).
The following code is roughly equivalent to this function:
MyHasBase(Value, BaseObj) {
b := Value
while b := ObjGetBase(b)
if b = BaseObj
return true
return false
}
For example, HasBase(Obj, Array.Prototype) is true if Obj is an instance of Array or any derived class. This the same check performed by Obj is Array; however, instances can be based on other instances, whereas is requires a Class.
HasBase accepts both objects and primitive values. For example, HasBase(1, 0.base) returns true.
Objects, Obj.Base, ObjGetBase, HasMethod, HasProp