enum inheritance

JS js.mdnq at gmail.com
Mon Jul 15 03:23:21 PDT 2013


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!


More information about the Digitalmars-d-learn mailing list