Source code of a method.

QAston qaston at gmail.com
Sun Oct 27 02:00:23 PDT 2013


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.


More information about the Digitalmars-d-learn mailing list