Inheritance/Single: Difference between revisions
Content deleted Content added
m →{{header|Perl 6}}: modernize |
→OOP Inheritance in TXR Lisp: Use latest OOP. |
||
Line 1,703:
<lang txr>(defstruct animal nil
name
(:method get-name (me)
▲ (if me.name me.name (error `get-name: animal @me has no name`))))
▲ (lambda (me stream)
▲ (error "abstract animal cannot speak"))))
(defstruct dog animal
(:method speak (me : (stream *stdout*))
(
(defstruct cat animal
(
(defstruct lab dog)
|