 Hello friends, I am Sanjay Gupta. In this video, I am going to demonstrate you the use of default constructor in C++. Before starting, you can note my information. You can connect with me by following these details. You can download my app based on programming that is Techimace, available on Google Play. You can search my YouTube channel by typing my name Sanjay Gupta on YouTube. You can open it. You can subscribe it by clicking on this button. You can watch various programming related videos and playlists which are available here. You can improve your programming skills by watching these videos. Now coming on to the topic, here I have implemented a simple code so that I can demonstrate you the use of default constructor. So constructors are used to initialize a specific value to the object at the time of their creation. So here header file IO stream is included. Then I have used namespace std which is predefined. It is for seen and see out. Then class complex. I have implemented for demonstration purpose. It's attribute real and imaginary in terms of IN, R and IR declared. Then in public section read function is defined. Inside read see out which will display enter real and imaginary message on console. And all is written for new line. Then the entered values will be stored inside R and I using C in. Then I have implemented print function which will display values of real and imaginary variables on console. And L is used for line termination. After termination of class main function is implemented which is creating an object C of complex type. Then only print function is called till now. So I am executing this code so that you can see the result. You can see it is printing zero and zero. And I have not called read function. Now if you want to print any object just after its creation and if you want to assign any specific values to that object just after its creation then you can do it with the help of default constructor. You can see I am assigning five inside R and I variables and this definition is of default constructor. So this time class contains three functions. First one is constructor then read function and then print function. Constructor is also similar to function but it is different because we don't have to call it. Now you can see I have not changed main function till now and I am directly executing this code. You can see the output real is printing five and imaginary is printing five. This is because of this default constructor. So friends just after creation of any object you want to assign any specific values to that object. You can create a default constructor and then you can check by printing the values of that object using print function call. If you want to create more objects like I am creating two objects C1 and C2 and I am calling print function for both the objects like this. So this default constructor will be initializing both the objects C1 and C2. Let's see what happens now. You can see both are printing five as real and five as imaginary values. So friends with the help of this default constructor you can initialize same values to the objects of class. You can change its value here if I change it to 15 15 then both the objects will be initialized by 15 and you can also assign different values to different attributes. Now again I am executing it. You can see 15 10 15 10 are displayed on console. So this way you can use default constructor. Now if you want to override these values you can call read function this way. So here first C1 C2 will be initialized using default constructor then C1 and C2 both are printed then C1 is calling read and for C1 I am calling print. So let's see what happens now. You can see 15 10 15 10 values are printed. Now it is asking for real and imaginary values. I am entering one and two. You can see one and two are displayed here. So if you initialized an object using default constructor you can override its values by calling this read function. So friends this is all about default constructor. You can implement only one default constructor in a class because it doesn't require any arguments. So there is one default constructor is possible in a single class. If you want to watch more programming related videos you can search my channel on YouTube by my name Sanjay Gupta. Here various programming related videos and playlists are available. You can improve your programming skills by watching these programming related videos. Thank you for watching this video.