- Home /
Question by
HolBol · Jul 12, 2014 at 05:44 PM ·
variableclassenumconstructor
Using an enum in a class constructor.
So say I needed to make a class with an enum in it. How would I write this into the class constructor?
Along the lines of this:
class CLASSY {
enum bacon {fried, grilled};
function CLASSY ( //WHAT DO I DO?){
bacon = //whatever;
}
}
Comment
Best Answer
Answer by gjf · Jul 12, 2014 at 05:58 PM
you'd probably define the enum outside of that class, unless it's only used in that class, then your function would probably look something like:
function CLASSY(baconType : bacon)
{
// do something with parameter baconType
}
unityscript isn't my forte so the syntax might be a little off...