[plt-scheme] inheritance of methods

From: Jamie Raymond (raymond at ccs.neu.edu)
Date: Fri Oct 3 12:20:55 EDT 2003

I think that link should be:
http://www.ccs.neu.edu/home/matthias/Tmp/spy.jpg

--
Jamie

On Friday, October 3, 2003, at 12:14 PM, Matthias Felleisen wrote:

> 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).



Posted on the users mailing list.