Future of contract-based programming in D
Pierre Krafft via Digitalmars-d
digitalmars-d at puremagic.com
Wed Apr 8 06:34:27 PDT 2015
On Wednesday, 8 April 2015 at 12:13:00 UTC, Kagamin wrote:
> On Wednesday, 8 April 2015 at 12:07:18 UTC, Pierre Krafft wrote:
>> Except for the syntax I can't come up with a problem that
>> would be better solved using inheritance than using
>> composition.
>
> How would you interate a collection of widgets without
> polymorphism, i.e. any generic handling?
I mention the tool I use in the post.
> On Wednesday, 8 April 2015 at 12:07:18 UTC, Pierre Krafft wrote:
> We have interfaces and alias this with @disable so composition
> is really easy to do.
So use a collection of interface instead of a collection of base
class. If you squint you could say that what I promote is a way
of doing inheritance, and I would agree. This is like doing
inheritance, with a bit worse syntax but with greater flexibility.
More information about the Digitalmars-d
mailing list