Function Hijacking article

Stewart Gordon smjg_1998 at yahoo.com
Thu Oct 18 09:02:47 PDT 2007


"Walter Bright" <newshound1 at digitalmars.com> wrote in message 
news:ff7req$28lq$1 at digitalmars.com...
> Stewart Gordon wrote:
<snip>
>> So the compiler generates an override that throws a runtime error?
>
> Yes.

I see now.  But function.html is out of date - the second example under 
"Function Inheritance and Overriding" is now bogus.  And I noticed that the 
requirement to specify the override attribute is neither implemented nor 
documented under attribute.html - what gives?

>> Does it apply to all overloads, or only where potentially compatible 
>> parameter types are involved?
>
> It applies to virtual functions that exist in the vtbl[], but are 
> inaccessible via anything typed with the derived class.

But if there's no chance of calling one intending the other, e.g.

class Qwert {
    void yuiop(int i)    { writefln("Qwert.yuiop: int %d", i); }
    void yuiop(string s) { writefln("Qwert.yuiop: string %s", s); }
}

class Asdfg : Qwert {
    override void yuiop(string s) { writefln("Asdfg.yuiop: string %s", s); }
}

should it still count?

Stewart.

-- 
My e-mail address is valid but not my primary mailbox.  Please keep replies 
on the 'group where everybody may benefit. 




More information about the Digitalmars-d-announce mailing list