[plt-scheme] inheritance of methods

From: Matthias Felleisen (matthias at ccs.neu.edu)
Date: Fri Oct 3 12:14:49 EDT 2003

In DrScheme, v205cvs-today, you can write it this OtherLanguage:

Welcome to DrScheme, version 205.3-cvs29sep2003.
Language: Python.
 > class Foo:
     def __init__(self, x):
         self.x = x
     def double(self):
         return 2 * self.x
 > class Bar(Foo):
     def __init__(self, x):
         Foo.__init__(self,x)
     def quadruple(self):
         return 2 * self.double()
 > f = Foo(2)
 > print f.double()
4
 > b = Bar(2)
 > print b.double()
4
 > print b.quadruple()
8

For a screen shot, see

http://www.ccs.neu.edu/Tmp/spy.jpg

-- Matthias

P.S. If you want to help, ask Daniel (cc'ed).
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 663 bytes
Desc: not available
URL: <http://lists.racket-lang.org/users/archive/attachments/20031003/f2a8157c/attachment.bin>

Posted on the users mailing list.