has_cvar (instance|class, variable)
An instance of a class; or a class.
An class variable name, as a symbol.
This function checks for the existence of class variables for a class or instance of a class. It searches all parent (base) classes.
This example is based on the class and method developed in method and class_add_cvar. The variable name is preceded by # to prevent evaluation. See Quote Operators for more information. |
Gamma> RegPolygon; #0=(defclass RegPolygon nil [(linethickness . 2) (perimeter . (defun RegPolygon.perimeter (self) (* (@ self sides) (@ self length))))][length sides]) Gamma> polyD; {RegPolygon (length) (sides)} Gamma> Square; (defclass Square RegPolygon [(area . (defun Square.area (self) (sqr (@ self length))))][length (sides . 4)]) Gamma> sqB; {Square (length) (sides . 4)} Gamma> has_cvar(RegPolygon, #linethickness); t Gamma> has_cvar(polyD, #linethickness); t Gamma> has_cvar(Square, #linethickness); t Gamma> has_cvar(sqB, #linethickness); t Gamma>
Copyright © 1995-2010 by Cogent Real-Time Systems, Inc. All rights reserved.