Advertisement
Guest User

Untitled

a guest
Nov 23rd, 2018
145
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. (defclass person ()
  2. ((name :initarg :name :accessor person-name)))
  3. (defmethod print-object ((self person) stream)
  4. (print-unreadable-object (self stream :identity t :type t)
  5. (format stream ":name ~S" (person-name self)))
  6. self)
  7. (defparameter *author* (make-instance 'person :name "Pascal"))
  8.  
  9. *author* ; --> #<person :name "Pascal" #x30200277E7AD>
  10.  
  11. (setf (find-class 'employee) (find-class 'person))
  12.  
  13. *author* ; --> #<person :name "Pascal" #x302002599CAD>
  14.  
  15. (make-instance 'employee :name "Jean") ; --> #<person :name "Jean" #x3020026FE96D>
  16.  
  17. (defmethod salary ((self employee)) 40000)
  18.  
  19. (salary *author*) ; --> 40000
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement