Using enums as function parameters (in a minimized way)

Ozan via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue Dec 1 02:44:06 PST 2015


Hi

Let's say we have an enum like

enum SomethingAboutChristmas {
   SantaClaus,
   Angel,
   Tree
}

and want to use it in a function like

   void goingChristmas(SomethingAboutChristmas enumvalue)

it works fine like following

   goingChristmas(SomethingAboutChristmas.Tree)

I prefer to use a shorter version

   goingChristmas(Tree)

because it's clear (for me), that "Tree" in "goingChristmas()" is 
an enum of "SomethingAboutChristmas"

Is any chance to do this? The DMD-compiler says no.

Thanke & Regards, Ozan



More information about the Digitalmars-d-learn mailing list