Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (defclass person ()
- ((name :initarg :name :accessor person-name)))
- (defmethod print-object ((self person) stream)
- (print-unreadable-object (self stream :identity t :type t)
- (format stream ":name ~S" (person-name self)))
- self)
- (defparameter *author* (make-instance 'person :name "Pascal"))
- *author* ; --> #<person :name "Pascal" #x30200277E7AD>
- (setf (find-class 'employee) (find-class 'person))
- *author* ; --> #<person :name "Pascal" #x302002599CAD>
- (make-instance 'employee :name "Jean") ; --> #<person :name "Jean" #x3020026FE96D>
- (defmethod salary ((self employee)) 40000)
- (salary *author*) ; --> 40000
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement