On 2/24/2014 3:41 AM, Steve Teale wrote:

extend void foo()   // Declared in base class as cumulative void foo()
{
    (cast(BaseClass) this).foo();  // Compiler does this for you
                                   // similar to changing a light bulb ;=)

    // the extra stuff
}

I think also that it might be necessary for the base class function to
return on behalf of the derived method as opposed to to it.

Does this make any sense?


I've often wished for something like that when working on OO-heavy stuff. Some virtual funcs are intended to always be called by all overriding functions, but without a way to enforce that, it becomes a scary error-prone choice of API design. And trying to design your way around that limitation can be a pain.

Reply via email to