diff --git a/cpp/templates.md b/cpp/templates.md index dce6cbc..d36fb86 100644 --- a/cpp/templates.md +++ b/cpp/templates.md @@ -20,7 +20,7 @@ Assume we have to swap two variables of int type and two of float type. Then, we using namespace std ; // creating a generic function ‘swap (parameter-list)’ using template : template -void swap( X &a, X &b) { +void swaping( X &a, X &b) { X tp; tp = a; a = b; @@ -31,8 +31,8 @@ void swap( X &a, X &b) { int main( ) { int a = 10, b = 20 ; float c = 10.5, d = 20.5 ; - swap(a , b); // function swapping ‘int’ elements - swap(c , d); // function swapping ‘float’ elements + swaping(a , b); // function swapping ‘int’ elements + swaping(c , d); // function swapping ‘float’ elements return 0; } ```