If you have an arglist with classes carpet
and image-rectangle
, the arguments better be of these classes or their subclasses. You can't pass NIL
, when your argument is declared to be of class carpet
.
Thus (if this
does not make sense. If you pass a carpet object, and you can't pass anything else, the test this
will always be true.
If you want to write a method for the NIL
object and a rectangle, then you can use the class NULL.
(defmethod carpet-append ((this null) (rect image-rectangle))
...)
Since CLOS does not have class combinators like OR or AND, you have to write a method for each case.