Private enum members + Descent

Yigal Chripun yigal100 at gmail.com
Sat Oct 24 23:46:18 PDT 2009


On 25/10/2009 01:22, Michel Fortin wrote:
> On 2009-10-24 18:45:10 -0400, Justin Johansson <no at spam.com> said:
>
>> Let me try again. You have a set of N things which are represented by
>> an enum definition. There is some subset of this set containing M
>> things (so M < N) which represents the things meaningful in a public
>> sense. The remaining Q=N-M members of the whole set are only meaningful
>> to some internal processing so this subset containing Q members are
>> designated private. I'm trying to think about this problem in an abstract
>> way; sometimes giving concrete examples like Color colors (pun intended)
>> the abstract problem.
>
> Sounds like you want enum inheritance: one enum being a superset of
> another. :-)
>
>
the idea of enum inheritance crossed my mind too.
I think the simplest way to do what you want is to have two enums, maybe 
one with the public members and one with the private ones.
another option, a private enum with all the values and a public one with 
just the public ones.



More information about the Digitalmars-d mailing list