 Hello friends, I am Sanjay Gupta. In this video I am going to demonstrate you how you can implement pre-increment and post-increment operations using operator overloading in C++. Before starting, you can note my information, you can connect with me by following these details which are available in front of you. Now coming on to the topic, you can see a code which is implemented in front of you. The comment is showing the objective post-increment and pre-increment operations using unary operator overloading in C++. For this purpose, I have included a header file IO screen, then std namespace is used, name of classes number, inside number class n attribute is declared, then public section is defining first function that is read. Inside read function, cout is printing enter a number message on console. The entered number will be stored inside n variable and that n is going to read through scene statement. After that print function is implemented inside print function value of n will be displayed on console. After print function, there are two functions are defined. You can see first function is defined with name plus plus and second function is also defined with name plus plus. Both have same name. Now I am removing this int for demonstration. So now you can see both the functions are sharing same name and they don't have any arguments. So in C++, if two functions have same name, then the concept of function overloading applied. But function overloading says you have to pass different number of arguments or different type of arguments. But here in both the functions, no argument is passed right now. So let's see whether it will work or not. You can see it is showing an error message. So you have to remove this error message by passing an argument in any function. But here you have to remember that you can pass argument in post increment implementation only because it is pre decided. So whenever you are implementing post increment operation, you can write any data type inside parenthesis. And in case of pre increment operation, you can leave these parenthesis blank. Now, if we go through with the definition of post increment operation. So first temporary object is declared, then value of n is assigned into t dot n and then n is incremented. So you can see first value of n is assigned and then it is increased. So it is post increment operation. And at last return t is returning t object, which is containing a particular value. And you can also notice that return type of this function is number, which is written here. Now coming on to the second function, which is implementing pre increment operation. Here again number class object t is declared. Now you can compare both the definition. Here n is incremented first and then it is assigned into t dot n and then t is returned to the main function. So now you can compare both the definition. First one is implementing post increment operation and second one is implementing pre increment operation. Now main function definition here four objects are declared and one and two and three and four and one and two are calling read function. Then n one plus plus it is calling pre increment definition and plus plus and two will call. Sorry and one plus plus is calling post increment definition and plus plus and two is calling pre increment definition. And then print function is called for and one and two and three and four objects. Now I am executing this code. I have entered two numbers one and two and you can see the output. It is displaying two three one three so and one is printing two and three is printing one. Now you can see that first and one value will be assigned into and three because it is post increment operation. So and one is one so and three will become one and after increment operation value of and two will become two. So and one is printing two and and three is printing one in case of pre increment operation. First value of and two will be increased so current value of and two is two. So it will be increased to three and then it will be assigned into and four. So it will also become three. Now you can see the output and two and and for both are printing three on console. So I hope you have understood how you can implement pre and post increment operations using unary operator overloading in C++. If you want to watch more programming related videos, you can subscribe my YouTube channel. That is Sanjay Gupta underscore tax school. Thank you for watching this video.