instance_vars

instance_vars — finds all the instance variables of a class or instance.

Syntax

instance_vars (instance|class)

		

Arguments

instance|class

An instance of a class, or a class.

Returns

An array of all instance variables defined for the given instance or class. If an instance is queried, then the values of all instance variables for that instance are also reported.

Description

Queries the instance variables of a class or instance.

Example

[Note]

This example is based on the class and method developed in method, class_add_ivar and class_add_cvar.

Gamma> polyD;
{RegPolygon (length) (sides)}
Gamma> sqB;
{Square (length) (sides . 4)}
Gamma> instance_vars(RegPolygon);
[length sides]
Gamma> instance_vars(polyD);
[(length) (sides)]
Gamma> instance_vars(Square);
[length (sides . 4)]
Gamma> instance_vars(sqB);
[(length) (sides . 4)]
Gamma>  
		

See Also

class, class_add_cvar, class_add_ivar