![]() ![]() (slot N ) )įor example defclass of a person which store full name, age and sex of a person:ĬLIPS > (defclass person (is-a USER ) (multislot full-name ) (slot age ) (slot sex (allowed-symbols male female ) ) )ĬLIPS > (make-instance John of person (full-name John Kowalsky ) (age 44 ) (sex male ) ) ) ĬLIPS > (make-instance Barbara of person (full-name Barbara Nowak ) (age 23 ) (sex female ) ) ) ĬLIPS > (instances ) of person A message-handler for an object responds to messages and performs the required actions. Classes that inherits builds a trees of classes:ĬLIPS > (defclass animal (is-a OBJECT ) )ĬLIPS > (defclass mammal (is-a animal ) )ĬLIPS > (defclass reptile (is-a animal ) )ĬLIPS > (defclass snake (is-a reptile ) )Īn instance is an object of a class that has values for the attributes.Īn object's behavior is defined by its message-handlers(handlers). A subclass inherits attributes from one or more superclasses. In order to define a class, you must specify one or more parent classes(called also as a superclass) of the class to be defined.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |