<HTML><BODY><br>Thank you! That is what I wanted.<br><br>Sat, 24 May 2014 09:11:39 +0100 от Matthew Flatt <mflatt@cs.utah.edu>:<br>
<blockquote style="margin: 10px; padding: 0px 0px 0px 10px; border-left-color: rgb(8, 87, 166); border-left-width: 1px; border-left-style: solid;">
<div>
<div class="js-helper js-readmsg-msg">
<style type="text/css"></style>
<div>
<base href="https://e.mail.ru/" target="_self">
<div id="style_14009191120000000565_BODY">At Sat, 24 May 2014 10:16:34 +0400, Roman Klochkov wrote:<br>
> Is there a way to make C++ way inheritance: if superclass has the method, then <br>
> override, else create new?<br>
> <br>
> I see in manual, that public requires " method must not be present already in <br>
> the superclass" and override requires "definition already present in the <br>
> superclass".<br>
> <br>
> Is it possible to not restrict the superclass?<br>
<br>
There's nothing built in (at the same level as `public` and `override`)<br>
to do that.<br>
<br>
You could use `method-in-interface?` to check whether a superclass has<br>
a method already and add the method if not:<br>
<br>
(define (fixup-for-m super%)<br>
(if (method-in-interface? 'm (class->interface super%))<br>
super%<br>
(class super%<br>
(super-new)<br>
(define/public (m . args) (void)))))<br>
<br>
(class (fixup-for-m super%)<br>
....<br>
(define/override (m ....) ....)<br>
....)<br>
<br>
</div>
<base href="https://e.mail.ru/" target="_self">
</div>
</div>
</div>
</blockquote>
<br>
<br>-- <br>Roman Klochkov<br></BODY></HTML>