Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions cpp/templates.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 <class X>
void swap( X &a, X &b) {
void swaping( X &a, X &b) {
X tp;
tp = a;
a = b;
Expand All @@ -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;
}
```
Expand Down