static void Main(string[] args) { IFactory factory = new StudentFactory(); LeiFeng leiFeng = factory.CreateLeiFeng(); leiFeng.Wash(); leiFeng.Sweep(); leiFeng.Cook(); }
public static LeiFeng CreateLeiFeng(string type) { LeiFeng result = null; switch (type) { case "Undergraduate": result = new Undergraduate(); break; case "Volunteer": result = new Volunteer(); break; } return(result); }