Overused topic I know, but this is not about performance.
If I use templates then, in this example, I would be limited to only creating lists of HTTP clients -OR- FTP clients, but not both types in the same list due to being different types. As apposed to virtual, obviously.
Sorry about the example and pseudo code.
Oh, and my question is if this is correct, and/or there are better options. Thanks.Code:class Protocol class HTTP : Protocol class FTP : Protocol templates: class Client<typename protocol> template <typename protocol> func CreateClient() client = CreateClient<HTTP>() client = CreateClient<FTP>() httpList = std::vector<Client<HTTP> > ftpList = std::vector<Client<FTP> > virtual: class Client Protocol* protocol func CreateClient(Protocol* protocol) client = CreateClient(new HTTP) client = CreateClient(new FTP) list = std::vector<Client>