//遍历访问员工集合中的每一个员工对象 public void accept(Department handler) { foreach (Employee obj in list) { obj.accept(handler); } }
/// <summary> /// 接受一个抽象访问者访问 /// </summary> /// <param name="handler"></param> public abstract void accept(Department handler);