Source code of a method.

TheFlyingFiddle theflyingfiddle at gmail.com
Sun Oct 27 09:00:45 PDT 2013


>> Hmm i never considered inheritance actually...
>> (I'm to used to the decorator pattern i guess ^^,
>> Normally i only inherit from interfaces and decorate)
>>
>> But now that you pointed it out it's a perfect fit!
>> Thanks for the help.
>
> You can use decorator the same way too.

Yes i know and that was what i was doing initially, however in 
this specific case its unessasary and provides a little more 
extra bagage then simply inheriting.

You get two objects instead of one => More cache locality 
problems aswell as more potential garabage the garabage collector 
needs to keep track of. (is this relevant? You never know. If i 
create 10000+ objects this way it's kinda relevant)

The main problem with this approach for me is that i can't make 
the classes i write final. It's not rly a hard thing to do but it 
breaks a force of habit.




More information about the Digitalmars-d-learn mailing list