Strange enum

orgoton orgoton at mindless.com
Wed Apr 11 12:11:54 PDT 2007


I have this in a class:

enum ActorType:ubyte
{Unit=0, Building=1, Other=2
}

then,
class Actor
{
this()
{
assert(this.getType()<5); //THIS FAILS
}
(...)
public final ActorType type=ActorType.Other;
protected ubyte getType()
{
return cast(ubyte)type;
}

}

In a static constructor, an Actor is created to test another class, and the program ends in an assert error.



More information about the Digitalmars-d mailing list