:- inherit +ClassName +Op +Name
ClassName names the class from which the message should be inherited, Op indicates which kind of message it is, and Name and Arity indicate the name and arity of the message to be inherited. You may include several inheritance specifications in one directive.
Be careful of the precedences of the message
operator and the
/ operator. You may need to use parentheses.
truck are defined as follows:
:-class toy. Self <- create. Self >> size(small). Self >> rolls(false). :- end_class toy. :- class truck. Self <- create. Self >> size(small). Self >> rolls(true). :- end_class truck.
toy_truck inherits its size from
toy and the fact that it rolls from
:- class toy_truck = toy + truck. :- inherit toy <- (create/O), toy <- (size/1), truck <- (rolls/1). :- end_class toy_truck.
Note that this is just a toy example.