Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public interface EmployeeFactory
- {
- Employee CreateEmployeeByType(EmployeeType employeeType);
- }
- public class EmployeeFactoryImpl : EmployeeFactory
- {
- public Employee CreateEmployeeByType(EmployeeType type)
- {
- switch (type)
- {
- case EmployeeType.COMMISSIONED:
- return new CommissionedEmployee();
- case EmployeeType.HOURLY:
- return new HourlyEmployee();
- case EmployeeType.SALARIED:
- return new SalariedEmploye();
- default:
- throw new ArgumentOutOfRangeException("type");
- }
- }
- }
- public class CommissionedEmployee : Employee
- {
- public override bool IsPayday() { throw new NotImplementedException(); }
- public override Money CalculatePay() { throw new NotImplementedException(); }
- public override void DeliverPay(Money pay) { throw new NotImplementedException(); }
- }
- public class HourlyEmployee : Employee…
- public class SalariedEmploye : Employee…
- }
Add Comment
Please, Sign In to add comment