I define two classes "BIg" and "Small" so that "Small" is a subclass of "Big":
Code: Select all
(defclass Big ()
( (my-value :accessor my-value)
))
(defclass Small (Big) () )
Code: Select all
(defmethod initialize-instance :after ( (item Small) &key )
(setf (my-value item) 13)
)
But then I execute the following code:
Code: Select all
(defgeneric Func (item) )
(defmethod initialize-instance :after ( (item Big) &key )
(setf (my-value item) (Func 666) )
)
But by some reason attempts to create instances of the class "Small", e.g. calls
Code: Select all
(setf x (make-instance 'Small ) )
My question is: why "initialize-instance" chooses method for the class "Big" even when an instance of the class "Small" is created?