Walter: extend existing classes with new methods?
Marcio
mqmnews321 at sglebs.com
Mon Sep 4 14:41:05 PDT 2006
Chris Nicholson-Sauls wrote:
> Okay... maybe I'm missing something here?
Yes, you are.
> I was pretty sure we already
> do have this, in a little OOP concept called inheritance?
Nope.
> Given a
> library defining 'class Foo', if I need custom behavior, I simply define
> a 'class MyFoo:Foo' and voila!
>
> Or is there some deeper concept that I'm overlooking entirely?
>
You want String to have a new method, say asURL. Or findReplace. Or
whatever. Not a new String subclass. You want to add functionality to
String.
You want all objects to understand dumpOn (aStream). Say you are
writing a persistent framework. You need to add methods to Object.
If you ever used Smalltalk, you'd know what I mean.
marcio
More information about the Digitalmars-d
mailing list