Function Hijacking article

Stewart Gordon smjg_1998 at yahoo.com
Thu Oct 18 14:17:24 PDT 2007


"Walter Bright" <newshound1 at digitalmars.com> wrote in message 
news:ff8fi1$fs7$1 at digitalmars.com...
> Stewart Gordon wrote:
<snip>
>> And I noticed that the requirement to specify the override attribute is 
>> neither implemented nor documented under attribute.html - what gives?
>
> It is documented in the function.html and attribute.html.

I still can't find it anywhere.

> It is implemented if you add the -w switch.

I see....

<snip>
>> 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?
>
> Yes, because Qwert can have a function which calls yuiop(int) with an 
> Asdfg instance.

I'm not with you.  How exactly does this render my example susceptible to 
the hijacking problem?

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