object - Maple Help

type/object

check for an object

 Calling Sequence type(expr, object)

Parameters

 expr - any expression

Description

 • This function checks if expr is of type object.
 • In Maple, you typically use a prototype object to define a class, and then use instances of that class to do what you want to do with them. Internally, however, there is no difference between the two, so both are of type object.  For more information on objects, see the Overview of Objects and Object Creation.
 • An object is a special type of module.
 • An object can implement a type override to allow the object to determine if it matches various types.  For more information, see object/builtins.
 • An object can also be viewed as a type itself. By default, testing whether an expression $e$ is of this type tests whether $e$ is an object that has the same module definition. For more details and how to refine this test, see ModuleType.

Examples

 > module Obj()    option object;    local data := 0;    export getData::static := proc( self::Obj )        self:-data;    end;    export setData::static := proc( self::Obj, d )        self:-data := d;    end; end:
 > $\mathrm{type}\left(\mathrm{Obj},\mathrm{object}\right)$
 ${\mathrm{true}}$ (1)
 > $\mathrm{newObj1}≔\mathrm{Object}\left(\mathrm{Obj}\right)$
 ${\mathrm{newObj1}}{≔}{\mathrm{Object<>}}$ (2)
 > $\mathrm{type}\left(\mathrm{newObj1},\mathrm{object}\right)$
 ${\mathrm{true}}$ (3)