Type properties

ric maicle via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jan 6 00:01:12 PST 2016


Why is init allowed to be redefined but not sizeof?

dmd 2.069

import std.stdio;

struct Foo {
     static int init = 5;
     static int sizeof = 0;
}

void main()
{
     writeln(Foo.init);
     writeln(Foo.sizeof);
}

Error: variable integer.Foo.sizeof .sizeof property cannot be redefined


More information about the Digitalmars-d-learn mailing list