Hello, and welcome to the 58th tutorial in the c++ programming series, and in this part we'll be looking at class copy constructor. The copy constructor allows you to perform something when copying a object to another object when it has been initialized, that was going to go ahead and open up a project. And what we're going to do is create a simple class called a copycat curly brace, semi colon, public methods and there we go. So it boy chassis, whenever you book these, it's going to create a regular constructor, as we have looked at before in this series. Now the copy constructor use the same name as the regular constructor. But inside you have something called const, which is a constant.
It's a copy object is actually a reference to a copy of jam can call it x in Cali wherever you want to Do colon, and then basically wanting to perform the little bit of functionality that I want. So what I'm going to do is saying I have, this means I have the new object will equal x i, boy 10 and see where the call x dot c will equal x dot c. And then we can have to put some curly braces like this. Obviously, we could own this within here as well with this just another way to do it. Could we create a copy constructor, we're just going to implement it, not actually going to do anything, we're just going to implement it with no content. And then the next step is to simply create a copy cat object. Want to call it CC, and CC, are equals value.
And what we're going to do Is to copycat and to create another copycat object. I'm going to call it okay. You pass in CC. I was going to print out. Okay. All right, the angle brackets here.
For landline and everyone this we get 50. And we got 50 simply because we use the copycat constructor which multiplies the value of it by 10. And if he does put C, we get a we have an initial acetal c dot c equals, we'll put up the capital T, when a and we get t because they haven't actually done anything. We see this as a straight copy. But we've I will multiply it by 10 hands why okay has been your 54 That's it for this point. This series in the next part we'll be looking at the frame function.
If you have any questions feel free to message us at support at solar systems kk the email will be in the description you can comment on this video or just directly messages while you do all the recording for source code will also be in the description. And as usual fun fortune and I hope you have a nice day