 Hello friends, I am Sanjay Gupta. In this video I am going to demonstrate you how you can implement swapping using function overloading in C++. Before starting, you can note my information, you can connect with me by following these details, you can download my app TechMS available on Google Play, you can search my channel on YouTube by typing my name Sanjay Gupta, my channel will be available there, you can open it and you can subscribe it if you want to watch various programming related videos and playlists. Now coming on to the topic, you can see a comment swapping using function overloading in C++ is written here, then header file IO stream is included, then namespace std is used, it is containing information related to scene and cout, that's why I have used this namespace, then swap function is defined, return type is void, then function name is swap, it is having two formal arguments of integer type a and b and these a and b are reference variables, so reference variable shares the location of actual arguments and if we change values of formal arguments then actual arguments also change because these formal arguments are reference variables, so in this definition if I will be changing value of a and b then their actual values will also be changed, so you can see that in main function x and y variables are declared, then swap function is called, here x and y of integer type values are passed, so this calling will link with this definition, here a and b will be sharing locations of x and y, so if you change values of a and b in this definition then x and y will be changed automatically, so this is the benefit of reference variables, so this function is implemented using reference variables, now you can see second function definition, it is also having same name as first, so this concept is known as function overloading, in C++ you can define more than one functions with same name, but remember number of arguments or type of arguments should be different, so in this code first function is containing two arguments of integer type, second is also containing two arguments of flow type, so here number of arguments are same but type is different that's why this function will work properly, it is also having a formal arguments as reference variables, so if we change values of a and b then actual arguments will also be changed, now you can see in main function this swap function is passing x and y of integer type, so this will call first function definition and this line number 24 is calling swap based on p and q and p and q are of flow types, so when first function call line number 21 will be executed, so first function definition will be called, when line number 24 will be executed, so second function definition will be linked automatically, so this is the benefit of function overloading in C++, you can define more than one functions with same name, now I am executing this code, you can see the output initial values of x and y are 5 and 10, but here it is displaying 10, 5 and float p and q, p is containing 10.25, q is containing 20.4, but here swapped values are displayed, so I hope you have understood how you can implement function overloading in C++ and also how you can use reference variables in C++, if you want to watch more programming related videos you can search my channel on youtube by sanjay gupta name, here various programming related videos and playlists are available, thank you for watching this video.