ClasSchemer example added by dzoe on Fri Feb 16 15:39:31 2024
(define-class Point2 (define x 0) (define y 0) (define (init x- y-) (print "init") (set! x x-) (set! y y-)) (define (pascal) (+ x y)) (define (norm2) (+ (* x x) (* y y))) (define (display) (print x "," y " (" self ")"))) (define-class (Point3 Point2) (define z 0) (inherit norm2 pascal) (define (display) (super) (print (pascal)) (print " >> " z)) (define (norm3) (+ (norm2) (* z z))) (define (init x- y- z-) (super x- y-) (set! z z-))) (define p2 (new Point2 1 2)) (send p2 display) (define p3 (new Point3 1 2 3)) (send p3 display) (print (send p3 norm3))