Enum "Inheritance"?

%u wfunction at hotmail.com
Thu Feb 24 17:31:38 PST 2011


>> Lol, okay. Do you have any other suggestions for a better
solution on how to avoid duplicating generic access masks like
MAXIMUM_ALLOWED inside each access mask type?

> You're doing it wrong. Create OO wrapper instead.

Hm... but:

(1) I'm not going to create a new instance of an entire class every
single time I need to check an access mask, that's wasteful. When
was the last time you created a "new int()" on the stack and all you
did was pass the dereferenced value to a function?

(2) A singleton pattern won't really work with bitwise OR, unless I
instantiate a new access mask object at each call, in which case we
go back to point (1).

Any other ways? Or am I misunderstanding this?


More information about the Digitalmars-d mailing list