Skip to content
Browse files
Added another comment for templates
  • Loading branch information
nagrat committed Mar 14, 2023
1 parent c7d0e46 commit 99d15752be2db8ca8260c9931dd679629292af8f
Showing 1 changed file with 1 addition and 0 deletions.
@@ -7,6 +7,7 @@ using namespace std;

template<class T> T add(T &x, T &y) { // template to make a function to add numbers
// the T means type meaning that the values of the parameters can be any data-type
// &x, &y are references to values that can be anything -> float, int, long, double etc
T result = x + y; // makes a return variable from the T class part; can be anything
// -> is now dynamically typed as it will find itself on runtime not beforehand

0 comments on commit 99d1575

Please sign in to comment.