(define point% (class object% (super-new) (init-field [x 0] [y 0]) (define/public (move dx dy) (new point% [x (+ x dx)] [y (+ y dy)])) (define/public (move! dx dy) (set! x (+ x dx)) (set! y (+ y dy))) )) (define color-point% (class point% (super-new) (inherit-field x y) (init-field [color 'black]) (define/override (move dx dy) (new color-point% [x (+ x dx)] [y (+ y dy)])) (define/public (paint c) (new color-point% [x x] [y y] [color c])) (define/public (paint! c) (set! color c)) )) (define P (send (send (new color-point%) move 3 4) paint 'red)) (read-line) (send* P (move! 2 8) (paint! 'blue))