call

Gamma: Version 4.0
Prev |  | Next

# `call`

`call` -- calls a class method for a given instance.

## Syntax

    call (instance, method, !argument...)
    call (instance, class, method, !argument...)

## Arguments

`instance`

  An instance of a class.

`method`

  A method name defined for the class of the instance.

`class`

  A class name.

`argument`

  The arguments to the method.

## Returns

The result of calling the named method on the given instance with the provided arguments.

## Description

This function explicitly calls a class method for the provided instance, using the same argument list as would be required for a call using `(instance method ...)` syntax in Lisp, or the `instance.method (...)` syntax in Gamma. The second syntax of this function provides a means for calling an explicit class method even if the class of the instance overloads the method name. Notice that the arguments to call are all evaluated.

## Example

| This example is based on the class and method developed in `method`.

        Gamma> call(sqB, Square, #perimeter);
        12
        Gamma> call(sqB, Square, #area);
        9
        Gamma>

## See Also

`method`

Prev | Home | Next
Core Functions | Up | `class_add_cvar`

Copyright 1995-2002 by Cogent Real-Time Systems, Inc.