defclass
defclass( s_className
( [ s_superClassName1 ]...[ s_superClassNameN ]
( [ ( s_slotName
[ @initarg s_argName ]
[ @reader s_readerFun ]
[ @writer s_writerFun ]
[ @initform g_exp ]
)
]
)
)
=> t
Description
Creates a class object with class name and optional super class name (or names) and slot specifications. This is a macro form.
If a super class is not given, the default super class is the standardObject class.
Each slot specifier itself is a list composed of slot options. The only required slot option is the slot name.
If you define a class with two slots that have the same name, as shown in the example given below, SKILL creates the class but also issues a warning.
defclass(A () ((slotA) (slotB) (slotA @initform 42)))
Arguments
Value Returned
Examples
defclass( Point
( GeometricObject )
(
( name @initarg name )
( x @initarg x ) ;;; x-coordinate
( y @initarg y ) ;;; y-coordinate
)
) ; defclass => t
P = makeInstance( 'Point ?name "P" ?x 3 ?y 4 )
defclass(A (B C) ((slot1) (slot2) (slot2 @initform 42)))
Related Topics
Return to top