function createEmployee(name, type) { return new Employee(name, type); }
function createEmployee(name, type) { switch (type) { case "engineer": return new Engineer(name); case "salesman": return new Salesman(name); case "manager": return new Manager (name); }
反向操作为 移除子类
别名 用状态/策略替换类型码,提取子类