source: branches/new-datamodel/playground/call-next-method_multiple-inheritance.lisp

Last change on this file was 224, checked in by lgiessmann, 14 years ago

new-datamodel: added a new sample file for call-next-mehtod in a multiple-inheritance scenario

File size: 1.1 KB
Line 
1(defclass CharacteristicC()
2           ((value :accessor value
3                   :initarg :value
4                   :type string)))
5
6(defclass DatatypableC()
7           ((datatype :accessor datatype
8                      :initarg :datatype
9                      :type string)))
10
11(defclass OccurrenceC (CharacteristicC DatatypableC)
12           ())
13
14(defgeneric equivalent-construct (construct &rest args))
15
16(defmethod equivalent-construct ((construct OccurrenceC) &rest args)
17           (format t "equivalent-construct --> OccurrenceC: ~a~%" args)
18           (call-next-method construct args))
19
20(defmethod equivalent-construct ((construct CharacteristicC) &rest args)
21           (format t "equivalent-construct --> CharacteristicC: ~a~%" args)
22           (call-next-method construct (first args))
23           (string= (value construct) (getf (first args) :value)))
24
25(defmethod equivalent-construct ((construct DatatypableC) &rest args)
26           (format t "equivalent-construct --> DatatypableC: ~a~%" args)
27           (string= (datatype construct) (getf (first args) :datatype)))
28
29(defvar *occ* (make-instance 'Occurrencec :value "value" :datatype "datatype"))
30
31(equivalent-construct *occ* :value "value" :datatype "datatype")
Note: See TracBrowser for help on using the repository browser.