Name

Class xbObject — root of Javascript Class Hierarchy

Revision History
Revision 1December 14, 2002 

Synopsis

class xbObject
{
  // constructor
  xbObject();
   
  // methods
  void init();
  void destroy();
  Variant parentMethod(String methodName, ...);
  Boolean isInstanceOf(Function otherClassConstructor);
  
  // properties
  String isa;
  Object classRef;
}
		

Source

xbObjects.js

See Also

_Classes

Description

xbObject is the root of the Class hierarchy. It serves as a means of guaranteeing that all classes have the minimal support required. It also is a means of quickly adding new features to all classes. xbObject is not intended to be instantiated.

Properties

isa

readonly String - Class Name.

classRef

readonly Object - reference to the entry for this class in the _classes object.

Methods

xbObject()

Constructs an instance of the xbObject class.

Returns. nothing

Exceptions

  • None

destroy()

Destroy instances of a class. Javascript does not automatically call destructors and relies totally upon garbage collection. You must explicitly call destroy if an instance of a class requires destroying. Destructors are especially important in long running scripts that make use of self referential data structures which are never automatically garbage collected. To chain destructors, perform any finalization of the current class and then call the parent's destroy method last.

Returns.  Nothing

Exceptions

  • None

parentMethod(String methodName, ....)

Call an overridden method of a parent class. The first argument is the name of the method to be called with the remaining arguments corresponding to the parent's method's arguments. If the parent method returns a value, parentMethod will return the value as well.

Returns.  Variant What ever the parent method returns.

Exceptions

  • What ever the parent method throws

isInstanceOf(Function otherClassConstructor)

Emulate JavaScript's instanceOf operator by returning true if the instance of a class inherits (via xbObjects) from the class defined by the constructor otherClassConstructor.

Returns.  Boolean true if this instance inherits from otherClassConstructor.

Exceptions

  • Error if otherClassConstructor is not derived from xbObject