Right now my class is set up as:
enum Unit{Inches,Centimeters};
Later on I have a step that sets all of the properties of each of these units into my classes instance variables. For example:
int unitBase; //10 for metric, 16 for american
int label;
switch(unit)
{
case Unit.Inches: unitBase = 16; unitLabel = "\"";break;
case Unit.Centimeters: unitBase = 10; unitLabel = "cm";break;
}
I would rather store this all in a Unit class or struct. Then, I would like to be able to access it in the same way you access colors, for example. You say Color.Blue for a blue color, I would like to say Unit.Inches for inches… That is why I dont make a unit base class and simply extend it.
I know that there is a way to do this! Could anyone enlighten me?
Thanks!
You can use static properties: