type/object - Maple Programming Help

Online Help

All Products    Maple    MapleSim


Home : Support : Online Help : Programming : Data Types : Type Checking : Types : type/object

type/object

check for an object

 

Calling Sequence

Parameters

Description

Examples

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:

typeObj,object

true

(1)

newObj1ObjectObj

newObj1Object<<Obj,139760413847616>>

(2)

typenewObj1&comma;object

true

(3)

See Also

object

Object

object/builtins

object/create

type

type/module