Bigloo homepage -- Object Example





 1: (module example
 2:    (export (class point
 3:               (x (default 0))
 4:               (y (default 0)))
 5:            (class point-3d::point
 6:               (z (default 0)))
 7:            (generic display-point ::point)))
 8: 
 9: (define-generic (display-point p::point)
10:    (print 'point))
11: 
12: (define-method (display-point p::point)
13:    (with-access::point p (x y)
14:       (print 'point " x: " x " y: " y)))
15: 
16: (define-method (display-point p::point-3d)
17:    (call-next-method)
18:    (with-access::point-3d (z)
19:          (print " z: " z)))
20: 
21: (let ((p (instantiate::point-3d (y 7.8))))
22:    (display-point p))

This Html page has been produced by Skribe.
Last update Tue Apr 18 14:18:16 2017.