static functions?

jerro a at a.com
Sun May 20 14:32:19 PDT 2012


On Sunday, 20 May 2012 at 21:19:14 UTC, p0xel wrote:
> This seems to work when the class is in the same file as 
> main(), but if I move it to it's own file and use "import foo" 
> it errors. What am I missing?

When you write "import foo;" and then foo.bar, the compiler 
thinks that
you a referring to a global function bar in module foo. To call 
static function bar of class foo in module foo write 
foo.foo.bar(). Or you could write "import foo : foo;" to import 
just the class foo from module foo and not the entire module.


More information about the Digitalmars-d-learn mailing list