我希望能够创建一个“工厂”,允许我传入一个类。returnsFunctionThatReturn(Dolphin)(); // should be a dolphin
returnsFunctionThatReturn(Seal)(); // should be a seal 这样的事情在TS中是可能的吗?
这个问题的背景可以从我以前的问题中找到。前一个问题:public interface Comm public int send(Socket socket, byte[] bytes);
}我有各种各样的类(Server,Client,Serial等)它实现了接口Comm。我可以将这些类对象作为参数传递给另一个<