[plt-scheme] Object system

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Sun Dec 21 09:32:15 EST 2003

At Sun, 21 Dec 2003 14:12:12 +0000, Guenther Schmidt wrote:
> I'd like to create a new class derived from one of MrEDs class,
> overwrite the, for instance, on-subwindow-char method, but still make
> a call within the new method to the super method.
> What is the proper procedure to do this, can it be done?
> As an example:
> (define my-text-field%
>  (class text-field%
>    (rename (sup on-subwindow-char))
>    (define/override-final on-subwindow-char
>      (lambda (x y)
>        (display y)
>        (newline)
>        (sup x y)))
>    (super-instantiate ())))
> This only works to a certain extent, I have to call "sub" at the very end 
> otherwise it won't work.

This is exactly the intended way to override a method and chain to the
overidden implementation.


Posted on the users mailing list.