Skip to content

Instantly share code, notes, and snippets.

@jitpaul

jitpaul/Intro0 Secret

Created May 4, 2018
Embed
What would you like to do?
Templates
/* Template Function. 'template <class T>' or 'template <typename T>'
can be used here.*/
template <class T>
void exampleFunction(T val) {
}
/* Template Class. 'template <class T>' or 'template <typename T>'
can be used here.*/
template <class T>
class ExampleClass {
};
int main() {
exampleFunction<int>(5); //Here 'int' is a template argument and '5' is a function argument
ExampleClass<int> ec1;//Here 'int' is a template argument
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment