 Hello friends, I am Sanjay Gupta. In this video, I am going to demonstrate you how you can implement constructor with default arguments in C++. Before starting, you can note my information, you can connect with me by following these details. You can download my app Techimus that is available on Google Play. Before starting, I am going to demonstrate you a code where you will be finding three constructors. Here one is default constructor and rest of two constructors are parameterized constructor. So this default constructor will initialize attributes of this complex class that are real and imaginary with 15 and 10 value. Parameterized constructor that is receiving single argument. This single argument A will be assigned into R and I will be initialized by 10. Then third constructor is receiving two arguments A and B and those arguments are assigned into R and I. Now in place of these three constructors, you can implement only one constructor that is known as constructor with default arguments. So I am removing these constructors and I will be implementing a single constructor which will work as default and as well as parameterized constructor. You can see the statement name of constructor is complex because it is the property of constructor that we have to use the name of class as constructor name. Then int A equals to 10 and int B equals to 20. Now R equals to A, I equals to B. This is constructor with default arguments. So you can see here A is receiving 10 and B is receiving 20. Then A and B both are assigned into R and I respectively. Then read and print functions are implemented. Now we have to relate this default constructor, sorry, constructor with default arguments with these object creation. So complex C1 and C2. Here two objects are created where we are not passing any value. So earlier it was calling default constructor, but here in this case it will call constructor with default arguments. And same for these objects C3 and C4 constructor with default arguments will be called. So here when C1 and C2 objects will be creating, no arguments will be passed. So A will receive 10 and B will receive 20. Then A and B will be assigned into R and I. So values of R and I will be 10 and 20 in case of C1 and C2. When C3 will be created, so 5 will be passed inside A. Here 10 will be ignored and A will receive 5. So friends, these 10 and 20 are known as default values. So if you are passing any argument, then that value will be preferred. If you are not passing any argument, then these 10 and 20 will be preferably stored inside A and B. When C4 object will be created, it is passing 30 and 40. So A will receive 30 and B will receive 40 and 10 and 20 will be ignored. So I hope you have understood how C1, C2, C3 and C4 three kind of objects are created or initialized with the help of single constructor. That is constructor with default arguments. Now in main function, all the objects are printed below. I am executing this code. You can see the output C1 and C2 are printing 10 and 20. C3 is printing 5 and 20 and C4 is printing 30 and 40. So I hope you have understood how single constructor can work as default as well as parameterized constructor. And this constructor is known as constructor with default arguments. If you want to watch more programming related videos, you can subscribe my channel that is sanjaygupta underscore tech school. Thank you for watching this video.