class_add_cvar (class variable init_value? type?);
The class receiving the new class variable.
The new variable to add to the class.
Optional argument for initial value of the variable.
Optional argument for the type of variable.
This function adds new class variables to either binary (built-in) or user-defined classes. Class variables are special variables that are available to be set/read by any instance of the class, as well as any derived classes or their instances, whether they were created before or after the class variable was defined.
This example is based on the class and method developed in method. |
Gamma> class_add_cvar(RegPolygon, #linethickness, 2); 2 Gamma> polyD = new(RegPolygon); {RegPolygon (length) (sides)} Gamma> polyD.linethickness; 2 Gamma> sqB.linethickness; 2 Gamma>
Copyright © 1995-2010 by Cogent Real-Time Systems, Inc. All rights reserved.