Overloading/Inheritance issue

BCS ao at pathlink.com
Thu Aug 2 10:28:49 PDT 2007


Reply to Chris Nicholson-Sauls,

> I've never really 100% understood why this is the way that it is, but
> there /does/ exist a simple workaround.  Add this line to Y:
> alias super.foo foo;
> Yep, alias the superclass's method into the current class's scope.
> The problem has something to do with the lookup rules.  At the very
> least, I would think that declaring Y.foo with the 'override'
> attribute might give the wanted behavior, since surely a int(int)
> couldn't override a int(), yes?  But no, last I checked, it doesn't
> work either.
> 

And this suffers from the issue that a function name and a function are not 
the same thing, a function name (which can be alised) refers to ALL function 
overloads (which can't be aliased). This is the cause of many bugs and hack-arounds.

<coff> um... Walter?





More information about the Digitalmars-d mailing list