When you call make-instance, Lisp (CLOS) performs the following steps.
- Initializes slots according to the defaulted initarg list
- Initializes any slots that have :initforma and are still unbound.
A simple example:
;;define the class person
(defclass person ()
((name :accessor name :initarg :name :initform "Some name")
(lastname :accessor lastname :initarg :lastname :initform "Some lastname")
(age :accessor age :initarg :age)))
;; a global variable to save the instance
(defparameter *person* nil);; a method to display the information
(defmethod display-person-information ((object person))(format t "Name:~a, Lastname ~a, Age: ~a~%" (name object) (lastname object) (age object)))
;; make-instance examples
(setf *person* (make-instance 'person :name "Juan" :lastname "Reynoso" :age 32));; display the information:
(display-person-information *person*)Name:Juan, Lastname Reynoso, Age: 32
;; another example
(setf *person* (make-instance 'person :age 100));; display the information:
(display-person-information *person*)Name:Some name, Lastname Some lastname, Age: 100
More information:
http://www.aiai.ed.ac.uk/~jeff/clos-guide.html
http://cl-cookbook.sourceforge.net/clos-tutorial/index.html