Source code of a method.

Gary Willoughby dev at nomad.so
Sun Oct 27 07:34:13 PDT 2013


On Sunday, 27 October 2013 at 09:00:24 UTC, QAston wrote:
> On Saturday, 26 October 2013 at 22:56:20 UTC, TheFlyingFiddle 
> wrote:
>>> I kind of did the same thing here in the Mockable mixin: 
>>> https://github.com/nomad-software/dunit Instead of wrapping i 
>>> simply extended the target class so i have access to 
>>> 'super.bar()'. Then i can add the specialisation code and/or 
>>> call the original method too.
>>
>> 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.

Can you provide a simple example please?


More information about the Digitalmars-d-learn mailing list