Allow static methods and fields for enum?

Jonathan M Davis via Digitalmars-d digitalmars-d at puremagic.com
Thu Jan 26 03:23:46 PST 2017


On Thursday, January 26, 2017 06:32:10 Profile Anaysis via Digitalmars-d 
wrote:
> Why not make enum a comparable type to structs and classes?
>
> They are static so they can't contain any mutable fields but
> surely they can contain methods? And especially they should be
> able to contain static methods!?

If you want an enum type with methods, use a struct type that has methods.
Enums don't have to be integral types.

- Jonathan M Davis



More information about the Digitalmars-d mailing list