digitalmars.D.bugs - Method Inheritance
- John Demme (21/21) May 13 2006 The below code doesn't work unless you uncomment out the alias. I think...
- Lars Ivar Igesund (11/38) May 14 2006 It's by design, believe it or not ;) It's been a while since the last
- Bruno Medeiros (7/38) May 19 2006 It was mentioned in:
- John Demme (6/44) May 20 2006 Ach!! ... Just a pain in the ass in my opinion-- I have to remember to p...
The below code doesn't work unless you uncomment out the alias. I think the reason for this was explained to me at some point, but I don't remember. Or is it a bug? I think it should be a bug. ~John Demme class A { void foo (int i) {} } class B: A { void foo (int i, int j) {} /+alias A.foo foo;+/ } void main() { B b = new B(); b.foo(5,7); b.foo(7); }
May 13 2006
John Demme wrote:The below code doesn't work unless you uncomment out the alias. I think the reason for this was explained to me at some point, but I don't remember. Or is it a bug? I think it should be a bug.It's by design, believe it or not ;) It's been a while since the last discussions I think, but it has to do with the overload rules (which apparently is the same as in C++, but different from those in Java). Walter is trying to make these rules simple, although IIRC, the corresponding Java-type rules were equally simple to understand for us mundane. I don't remember how it affected compiler complexity.~John Demme class A { void foo (int i) {} } class B: A { void foo (int i, int j) {} /+alias A.foo foo;+/ } void main() { B b = new B(); b.foo(5,7); b.foo(7); }-- Lars Ivar Igesund blog at http://larsivi.net DSource & #D: larsivi
May 14 2006
John Demme wrote:The below code doesn't work unless you uncomment out the alias. I think the reason for this was explained to me at some point, but I don't remember. Or is it a bug? I think it should be a bug. ~John Demme class A { void foo (int i) {} } class B: A { void foo (int i, int j) {} /+alias A.foo foo;+/ } void main() { B b = new B(); b.foo(5,7); b.foo(7); }It was mentioned in: news://news.digitalmars.com:119/e3knre$2vp1$1 digitaldaemon.com namely:In http://www.digitalmars.com/d/function.html , "Function Inheritance and Overriding" it is said: "However, when doing overload resolution, the functions in the base class are not considered:" If that is the ideal behavior, well, that I'm not sure...-- Bruno Medeiros - CS/E student http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D
May 19 2006
In article <e4lnue$s42$1 digitaldaemon.com>, Bruno Medeiros says...John Demme wrote:theThe below code doesn't work unless you uncomment out the alias. I thinkAch!! ... Just a pain in the ass in my opinion-- I have to remember to put in aliases for each method. Thanks for the links. ~Johnreason for this was explained to me at some point, but I don't remember. Or is it a bug? I think it should be a bug. ~John Demme class A { void foo (int i) {} } class B: A { void foo (int i, int j) {} /+alias A.foo foo;+/ } void main() { B b = new B(); b.foo(5,7); b.foo(7); }It was mentioned in: news://news.digitalmars.com:119/e3knre$2vp1$1 digitaldaemon.com namely:In http://www.digitalmars.com/d/function.html , "Function Inheritance and Overriding" it is said: "However, when doing overload resolution, the functions in the base class are not considered:" If that is the ideal behavior, well, that I'm not sure...-- Bruno Medeiros - CS/E student http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D
May 20 2006