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.
class HTTP : Protocol
class FTP : Protocol
class Client<typename protocol>
template <typename protocol>
client = CreateClient<HTTP>()
client = CreateClient<FTP>()
httpList = std::vector<Client<HTTP> >
ftpList = std::vector<Client<FTP> >
func CreateClient(Protocol* protocol)
client = CreateClient(new HTTP)
client = CreateClient(new FTP)
list = std::vector<Client>