如果我有两个类,“A”和“B”,我该如何创建一个通用工厂,以便只需将类名作为字符串传递即可接收实例?
例如:
例如:
public static void factory(String name) {
// An example of an implmentation I would need, this obviously doesn't work
return new name.CreateClass();
}
Thanks!
Joel