 Hello friends, I am Sanjay Gupta. In this video, I am going to demonstrate you how you can compare two strings by 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, in this video, I am going to demonstrate you string comparison by operator overloading in C++. I have included two header files IO string and string.h, then I have used a namespace std which is predefined namespace, then name of class is string, inside string class an attribute str is declared of character type, its size is 10. Then in public section, the function is implemented which will display a message enter a string using cout and the entered string will be stored inside str using seen statement. Then operator equals to function is defined. So this definition is overloaded operator function definition and here I have overloaded double equals to operator. Its return type is integer. This operator is a keyword and this x will receive values of explicit argument. So here you can see I have implemented if statement which is using strcmp, predefined function in string.h, it will compare two strings. First one is str which belongs to implicit argument and second one is x.str which belongs to explicit argument. So implicit and explicit arguments are compared if they are equal, then strcmp will be equals to zero. Otherwise, it will be unequal or not equals to zero. So if this condition is true, then return one statement will be executed and one will be returned by this function. Otherwise, zero will be returned through this function. After completion of this class, I have implemented main function. Here you can see I have created two objects. First one is s1 and second one is s2. Then read function is called through s1 object and again read function is called through s2 object. Here in if statement s1 equals to s2. This is a function call and here equals to operator is called through s1 and s2. s1 will be passed implicitly and s2 will be passed explicitly. So in the definition part, you can see this str is representing s1 value and this x.str is representing s2 value because s1 is here implicit and s2 is explicit argument. So if this overloaded function will return one, then this if condition will become true. So it will print strings are equal. Otherwise it will print strings are not equal. So this way I have called double equals to operator in main function by defining the this function definition. So this is all about this program, which is comparing two strings by overloading double equals to operator in C++. Now I am going to execute this code. I am entering same strings in both the objects that Sanjay Sanjay you can see output strings are equal. Now again, I am going to execute this code. First strings is Sanjay and second one is Vikas. You can see output strings are not equal. So this way you can see that this program is working properly. So I have demonstrated you how you can overload double equals to operator to compare two strings in C++. If you want to watch more programming related videos, you can subscribe my YouTube channel that is sanjaygupta underscore tech school. Thank you for watching this video.