Please note, this is a STATIC archive of website www.tutorialspoint.com from 11 May 2019, cach3.com does not collect or store any user information, there is no "phishing" involved.
(defclass food () ())
(defmethod cook :before ((f food))(print "A food is about to be cooked."))
(defmethod cook :after ((f food))(print "A food has been cooked."))
(defclass pie (food) ((filling :accessor pie-filling :initarg :filling :initform 'apple)))
(defmethod cook ((p pie)) (print "Cooking a pie.")(setf (pie-filling p)(list 'cooked (pie-filling p))))
(defmethod cook :before ((p pie)) (print "A pie is about to be cooked"))
(defmethod cook :after ((p pie)) (print "A pie has been cooked."))
(setq pie-1 (make-instance 'pie :filling 'apple))
(cook pie-1)
Advertisements
We use cookies to provide and improve our services. By using our site, you consent to our Cookies Policy.
AcceptLearn more