June 03, 2002 bug: overloaded function with same name as derived function | ||||
---|---|---|---|---|
| ||||
Two things can we have a new news group d.bugs for just compiler bug reporting and checking if issues are known bugs or required features. It appears, that if you overload a function that you have not overrided the compiler can not find it. in delphi there is the overload attribute, D has override (which I belive is optional) but no overload or explicit way to import from superclass as the compiler when overloading. you will see in the following code example. import c.stdio; class B { bit func() { return true; } // but works without problem bit spam() { return false; } } class D : /* public */ B // the public did not improve things, strange that was allowed! { int func( char[] name ) { return name.length; } // but this solves the problem :( // comment this out and this does not compile bit func() { return super.func(); } } int main( char[][] args ) { D d = new D(); if ( d.func() ) { return d.func( args[0] ); } if ( d.spam() ) { return args.length; } return 0; } |
June 05, 2002 Re: overloaded function with same name as derived function | ||||
---|---|---|---|---|
| ||||
Posted in reply to mike.wynn | Agree on the separate bug group. <mike.wynn@l8night.co.uk> wrote in message news:adgn0d$2c15$1@digitaldaemon.com... > Two things > > can we have a new news group d.bugs for just compiler bug reporting and checking if issues are known bugs or required features. > > It appears, that if you overload a function that you have not overrided > the compiler can not find it. > in delphi there is the overload attribute, D has override (which I belive is > optional) but no overload or explicit way to import from superclass as the compiler when overloading. > > you will see in the following code example. > > import c.stdio; > > class B > { > bit func() { return true; } > // but works without problem > bit spam() { return false; } > } > > class D : /* public */ B > // the public did not improve things, strange that was allowed! > { > int func( char[] name ) { return name.length; } > // but this solves the problem :( > // comment this out and this does not compile > bit func() { return super.func(); } > } > > int main( char[][] args ) > { > D d = new D(); > > if ( d.func() ) > { > return d.func( args[0] ); > } > if ( d.spam() ) > { > return args.length; > } > return 0; > } > > |
Copyright © 1999-2021 by the D Language Foundation