What's the secret to static class members
Mike Parker via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Jun 29 08:42:45 PDT 2016
On Wednesday, 29 June 2016 at 15:33:58 UTC, Guido wrote:
> The problem is actually much more profound. The classes need to
> be declared outside the main() scope. WTF?!?!?!
It's not going to work anywhere if you type 'Class' as opposed to
'class'. Types can be declared in any scope:
```
void main() {
class Foo {
static int x = 10;
}
assert(Foo.x == 10);
}
```
More information about the Digitalmars-d-learn
mailing list