private void btnEnumVariables_Click(object sender, EventArgs e) { //here is how to declare a enum variable emPloyeeType workRole = emPloyeeType.maintenance; Employee newHireA = new Employee("John", workRole); //without the ENUM VARIABLE, Employee can be instantiated too; Employee HireA = new Employee("John", emPloyeeType.maintenance); rtbDisplay.Text = newHireA.Name + " worked in the area of " + newHireA.TypeOfWork + "."; //an employee could be reassigned a role workRole = emPloyeeType.management; newHireA.TypeOfWork = workRole; rtbDisplay.Text += @" He now works at " + newHireA.TypeOfWork; }
public Employee(string n, emPloyeeType t) { Name = n; TypeOfWork = t; }