Ask your own question, for FREE!
Computer Science 11 Online
OpenStudy (anonymous):

hello guys :D I don't understand what are templates in C++ used for?

OpenStudy (anonymous):

templates are basically used to reduce code repetition. they allow you to have functions and classes that operate around different types, while still using static typing. for instance, what if you want a list of integers and a linked list of strings? instead of writing two separate classes like IntList and StringList, you just use std::list<int> and std::list<std::string> or something like that.

OpenStudy (anonymous):

in practice they have a lot of other uses and can get incredibly complicated, but thats the short version

OpenStudy (anonymous):

Great; I was wondering what they were used for too :-P

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Latest Questions
Arriyanalol: i need help
1 day ago 7 Replies 1 Medal
Arriyanalol: CONGRATS to me
2 days ago 8 Replies 2 Medals
Legomaster346: What colleges are good that are near Arab Alabama?
1 week ago 5 Replies 0 Medals
Arriyanalol: i need help
1 week ago 6 Replies 2 Medals
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!