Defstruct defines classes
(defstruct s-rectangle
(x 0)
(y 0)
width
height)
(class-of (make-s-rectangle))
=> #<structure-class s-rectangle>
(defmethod area ((shape s-rectangle))
(* (s-rectangle-width shape)
(s-rectangle-height shape)))
Previous slide
Next slide
Back to first slide
View graphic version