using System;
[Flags]
public enum Contribution {
Pension = 0x01,
ProfitSharing = 0x02,
CreditBureau = 0x04,
SavingsPlan = 0x08,
All = Pension | ProfitSharing | CreditBureau | SavingsPlan
}
public class Employee {
private Contribution prop_contributions;
public Contribution contributions {
get {
return prop_contributions;
}
set {
prop_contributions = value;
}
}
}
public class Starter {
public static void Main() {
Employee bob = new Employee();
bob.contributions = Contribution.ProfitSharing | Contribution.CreditBureau;
if ((bob.contributions & Contribution.ProfitSharing)== Contribution.ProfitSharing) {
Console.WriteLine("Bob enrolled in profit sharing");
}
}
}
|