[plt-scheme] Overriding private methods with class.ss?

From: Henk Boom (lunarc.lists at gmail.com)
Date: Sat Aug 18 15:31:00 EDT 2007

Hi, I was reading the class.ss documentation in the help desk, and as
far as I can tell there is no way to have private overridable methods:

A method declared with private is not accessible outside the class
expression, cannot be overridden, and never overrides a method in the

So, let's say I have a scene class. This scene class has a
"handle-event" method which takes an event and returns a boolean
signifying whether or not the event was handled. Now, I have a
"key-handling-scene" subclass to ease the work of handling
specifically key events, and it adds these:

(define/private (handle-key key-event) #f)
(define/override (handle-event event)
  (or (and (key-event? event) (handle-key-event event))

So the subclass would be able to override "handle-key-event" to handle
keys without having to bother at all with other events. Obviously this
won't work if you can't override private methods. What should be done

    Henk Boom

Posted on the users mailing list.