Needed return type in static method? bug or feature?
Antonio Corbi via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue Mar 8 05:40:06 PST 2016
Hi all!
The following code compiles and works, but the static methods do
not
have a return type. It also compiles and works if the appropiate
(or auto)
return type is added to them.
-----------------8><----------------------------
import std.stdio;
class B {
int foo () { return 1; }
static sbar () { return "hi!"; }
static ibar () { return 0; }
}
void main () {
auto b = new B;
writeln (B.sbar);
writeln (B.ibar);
}
-----------------8><----------------------------
Is it a feature or a bug?
I've seen it being used in
https://github.com/gecko0307/dlib/blob/master/dlib/math/matrix.d
Thank's for your help!
More information about the Digitalmars-d-learn
mailing list