enum inheritance

Namespace rswhite4 at googlemail.com
Mon Jul 15 04:00:45 PDT 2013


On Monday, 15 July 2013 at 10:23:22 UTC, JS wrote:
> On Monday, 15 July 2013 at 10:17:08 UTC, JS wrote:
>> On Monday, 15 July 2013 at 08:20:20 UTC, Namespace wrote:
>>> Maybe this way?
>>>
>>> ----
>>> final abstract class Colors
>>> {
>>> 	enum Red { RedOrange }
>>> 	enum Green { GreenBlue}
>>> 	enum Blue { BlueYellow }
>>> }
>>>
>>> void main() {
>>> 	Colors.Red foo = Colors.Red.RedOrange;
>>> 	assert(foo >= Colors.Red.min && foo <= Colors.Red.max);
>>> }
>>> ----
>>
>> but RedOrange and GreenBlue have the same value!
>
> Also, Colors.Red is not a value!
Then: good luck.


More information about the Digitalmars-d-learn mailing list