 Hello friends, I am Sanjay Gupta. In this video, I am going to demonstrate you how you can implement copy constructor in C++. Before starting, you can note my information. You can connect with me by following these details. You can download my app Takamis that is related to programming. It is available on Google Play. Now coming on to the topic, I am going to demonstrate you the use of copy constructor in C++ and how you can implement it. So first I am implementing a, sorry, including a header file IO stream. Then I am using a namespace std. For demonstration purpose, I am implementing a class complex. Complex has two attributes, real and imaginary. Then in public section, first I am defining default constructor. This is default constructor. Default constructor here is initialized in real with 10 and imaginary with 20. After this, I am implementing copy constructor. So friends, copy constructor is a spatial constructor which copies attributes an object into another object. So as you know, constructors are called when objects are created. So whenever you are creating any object and you want that object will receive values of already created object, then in that case, you can implement copy constructor. So here I am writing two statements. First is real equals to C dot R and second is imaginary equals to C dot imaginary. So this formal argument, which is a reference variable also is assigning its values into R and I. Now I am implementing print function which will display real values as well as imaginary values on console. This is termination of class. Now I am implementing main function. Inside main function, I am creating first object that is C1. Now I am printing its values using print function and I am writing a statement return zero because return type of main is integer. So right now I have created only one object. This object will call default constructor for initialization. So default constructor will initialize 10 and 20 inside R and I for the C1 object. Then I am printing it. So first check whether it is working properly or not. It is working properly. Real is 10 and imaginary is 20. Now I am creating another object that is C2 and I want that values of C1 will be assigned into C2. So I am passing C1 inside it. Here copy constructor will be called. Now I am printing values of C2. So C1 is printing 10 and 20. Then C1 is assigned its values into C2. So according to the statement C2 must be printing 10 and 20. So let's check whether it is happening or not. You can see that both are printing 10 and 20. So friends, I hope you have understood how you can assign values of an object into another object at the time of its creation using this statement and with the help of copy constructor. So in this case only we can use copy constructor. Otherwise you can implement default and parameterize constructor if you are passing any integer float or character value. So also remember copy constructor works on this concept that is belongs to reference variable. So if you want to implement copy constructor then formal parameter must be a reference variable because it shares memory location of explicit argument and extra memory will not be required here. I hope you have understood the difference between default parameterized and copy constructor. I have not demonstrated parameterized but it is similar to default. In default we don't have to pass arguments. In parameterized we pass arguments in terms of integer and floats. But in case of copy constructor we pass arguments as objects. So implement this concept at your own. Thank you for watching this video.