COPY CONSTRUCTOR IN C++ ( 33)
Vložit
- čas přidán 15. 02. 2017
- COPY CONSTRUCTOR IN C++
The copy constructor is a constructor which creates an object by initializing it with an object of the same class, which has been created previously. The copy constructor is used to:
Initialize one object from another of the same type.
Copy an object to pass it as an argument to a function.
Copy an object to return it from a function.
If a copy constructor is not defined in a class, the compiler itself defines one.If the class has pointer variables and has some dynamic memory allocations, then it is a must to have a copy constructor.
Mail: aniproguy@gmail.com
Music:BACK IN SUMMER by Nicolai Heidlas Music / nicolai-heidlas
Creative Commons - Attribution 3.0 Unported- CC BY 3.0
creativecommons.org/licenses/b...
Music provided by Audio Library • Video
------------------------------------------------------------------------------------------------
Suggested Videos
Function Overloading (FUNCTION IN C++ - PART 4) :- • Function Overloading (...
Void or Generic Pointer in c++ :- • Void or Generic Pointe...
Variables and Data Types in C++ :- • Variables and Data Typ...
Data Type Range in C++ :- • Data Type Range in C++...
Comments in C++:- • Comments in C++ -7
Inline Function - FUNCTION IN C++ (PART - 3) :- • Inline Function - FUNC...
Function Overloading (FUNCTION IN C++ - PART 4)
• Function Overloading (...
Class and Objects(part-3)[VISIBILITY MODES IN C++] :- • Class and Objects(part...
Class and Objects[Most Important Video] Part-5 (Complex Number Program)
• Class and Objects[Most...
STATIC FUNCTIONS IN C++ :- • STATIC FUNCTIONS IN C+...
CONSTRUCTOR IN C++ ( SYNTAX AND PROGRAM AND ALL POSSIBLE ERRORS)
• CONSTRUCTOR IN C++ ( S...
STATIC VARIABLE OR STATIC DATA MEMBER IN C++ :- • STATIC VARIABLE OR STA...
Constructor Overloading in C++- 32 :- • Constructor Overloadin...
Hey Guys,
I have made a mistake at 2:35
There are only two forms of calling copy constructor.
------------------------------
example obj1(50);
example obj2;
obj2 = obj1;
This is not invoking the Copy Constructor.
------------------------------
Here assignment operator(=) is overloaded by default by the Compiler.
I am truly sorry Guys, it won't happen again.
----------------------------------------------------------------
Special Thanks to Mayuri Popat for pointing out my Mistake.
Mayuri ne Popat kr diya
js kiddin(. ❛ ᴗ ❛.)
Thanks
There are many C++ programming tutorials on CZcams but to understand most of them, you really need to be very attentive and after watching one or two of those videos, you get saturated and feel unable to move further. You are unable to watch more than 3-4 videos at a stretch - but these tutorials are so beautiful. These are so simple, easy on the mind and effective. This is a revolutionary channel. Brilliant work... Keep uploading more videos to help Computer Science students and to make it easier for us to earn our degrees !!!
Thank u so much Harsimran . I think , I achieved my Goal.
Thanks a lot for this comment and I will keep on uploading more good stuff
Don't forget to share and
Keep on watching and keep on learning
Don't stop. Keep uploading, understanding programming has never been this fun and easy.
These are the best videos on C++ I've seen on youTube!! You are amazing and thank you so much for creating this! I hope these videos make you rich cuz you deserve it! Keep it up!
Thanks AnonymousFox
Have you seen Codearchery.com teaser?
czcams.com/video/cqLdlBaohLU/video.html
Did you like it ?
crisp and clear approach of teaching.
Truly by watching your video alone I'm going to attend my sem, with lot more confidence! Never ever stop doing this :) you are tooo great !
Despite the mistake you made, this video is just on point. You explained everything so well, thank you.
Love and respect from Sri Lanka,This is the Great Video series on C++
plz never stop making videos like this
Very well presented. easy to understand.
I am preparing for my placements. These lectures are really helpful. Thank you sir !!
when we try to copy any constructor manually we are doing a kind of copy that allows us to access to the current copied constructor's attributes, which means we can change a particular attribute values as well us keeping them as they are. thanks Codearchery for this awesome explanation.
LITERALLY THE BESTTTT!!!!!!!!!
as always SUPERB !
For The First Time in my life I enjoyed and very interested watch lectures.
just keep going on dont change your style.
Great video!
yoooo nice job,good work man please carry on
That's really helped me thank you
Just wow...Superbly awesome 🥰
Really I was enjoying it
Fully satisfied for this concept in this way thank you
Yes Bro. Your video deserves LIKE.
Saw many videos but never see this type of video Amazing
Really awesome way to teach using animation. I love it keep updating
BEAUTIFUL!!
Thanks a lot man
I appreciate u r work
So amazing.... Superb....Kya CZcamsr h yr....
Tks for a good video
Thanks a lot
Difference way unique explanation...
Can easily understand all concept within 4 to 5 min only.thats a great video smart work I like.it👌👌👌👌
Very good video and so funny, btw it is always a good practice to set copy constructor params as const reference :)
u r great explanier
You Know ,how to make people understand something , better than many.
thanks a lot
Very nice teaching method😍
thank u very much
Perfect explain👍
Very good
great job dear just outstanding tutorials
Nice work
Epic!
I hope all the best for you ❤️
Ya deserve a like!!
Methodology 🙌🏻❤
really appreciated
good work...
Thanks Masbha for watching my videos :-)
I hope you'll love to help me by sharing My Channel with Your Friends
Keep on Watching and Keep on Learning
C
Thanks
Hi, when you write exmaple ob1(50); example obj2; are calling parameterise and default constructor. When you write obj2 = obj1; them is calling assigment operator. I think. Great videos.
good concept.. i like the way you teach
Thanks a lot Rahul , I hope you'll love to share this channel with your friends too .
Keep on Watching and learning :-)
Best
@2:34 is assignment operator NOT copy constructor. Else it is a great video.
Samar Yadav it is a copy constructor
Thank Good Video
Thanks Junaid for Watching my Videos
I hope you would like to help me by Sharing My Channel with your Friends
Keep on Watching and Keep on Learning
isn't the second way of calling copy constructor '=' operator overloading??!
How I practice c++ programming to clear each concepts and also how to improve logic pls tell me sir your videos are really help me to learn c++ keep making videos.....🙏👍
why have you written & symbol in the argument list of copy constructor? explain please.
my brother you are the best instructor on youtube
i want to be your friend on facebook
Why does the default contructor have access specifier?
Can u give brief on non parameterised with syntax and program
very good
Thanks Pratham
Plz Share My Videos with your friends
But sir,"data" is private member data,i understand dummy is a reference to obj1 in this example I don't have a doubt in that,but how could you use dummy.data in copy constructor???can someone help please!!!!!!
Please make videos of c++ 11 and c++14 concepts
Very useful!.keep making videos like this😍
you didn't explain:-
1- Shallow copy n deep copy
2- Copy constructor parameter : why const specifier n pass by reference
Why we use two variables x and data.. One is for copying other value?
but what is the use '&' in copy operator???
Can you explain shallow copy and deep copy concepts...
Yeah why not , I will be uploading the videos in upcoming few days
i never get what my teacher teaches in skul.
but aftr watching your videos i understood everything written in book
Wow....... I am happy that My Channel is so much Useful
Hey Parishi Share My Channel with Your Teacher :-P So that your teacher can teach the fun in Programming to students
hahaha for sure
never mind
can you pls upload videos of pointers
3:06 whats that example ( example & data){
data = dummy.data
}
is syntax of copy constructer ? Or something else
You got it right , this one is the syntax of copy constructor
How to practice c++ programming to clear each & every concepts & also how to develop logic pls tell me sir.....🙏👍
Why some programs in use int main() then some programs in use void main() if I wrote the program how I choose main() bro
Nice video.
But copy constructor manually is not clear to me.
Any video reference for understanding copy constructor manually , for clearing our concept
Sir pls make video on type conversion -basic to class, class to basic or class to class.
can you make this type of video for java , phyton and javascript actually i enjoyed learning like this hope you wll reply soon thank you team codearchery thanks a lot
What does end1 mean?
bro which software u use for making these videos
video scribe
Uses of copy constructors?
From which country you are?
I'm confused . Example obj2; obj2 =obj 1 ; how does this involves copy constructor as object is not copyed at construction.
it's not. He made a mistake. It is actually assignment operator.
right its assignment operator call,not copy constructor
One day this channel have millions of subscribers .
Sir As compiler will make a copy constructor if we don't make. In actual argument we are passing obj2 of example type as, example obj1(obj2).It means we are passing value of example type of obj2.. Why we need to put reference operator at formal argument inside the parentheses eg. example ( example &dummy) to copy obj1 to obj2 ? Here dummy is nothing but obj2 .Without reference operator it gives error.The content will be copied to obj1 no doubt. Why reference operator is compulsory. Is there any other way to copy without & operator.?
sir small doubt in copy constructor defining... data=dummy.data
this line is not properly clear
look we are copying data manually
so we are representing dummy as object.
the variable data belongs to the newly created object.
And dummy.data means data variable which is present in the object dummy.
Okay You might get confused with all of this , Keep on Watching further videos and Keep on Practicing
You will understand what this line means when you practice a lot:-)
Suryansh Choudhary The copy constructor is a function and therefore behaves like other functions. Here the object, obj1, is passed-by-reference so it is automatically dereferenced just by saying "dummy.data" (instead of "(*dummy).data" or "dummy->data".) The calling object is obj2 so "data" needs no "object_name..." in front of it. (Remember, as far as the written code goes, the only difference between passed-by-reference and pass-by-value is the & in the parameter list. Everything else in the text is the same.) Does that help?
Sir mje book 📖 S bilkul smj ni aaaa ra ta... you helped me alot
Do this for every Concept.
First Watch my Video and then read the book :-)
And you will understand everything
But in this prgm u didn't creat object for default constructor?
Other two objects carry parameters... Then how it'll run default constructor.... But ur prgm has executed!!!! 🤷🏼♀️ Help me to clear this doubt
If we can make a copy constructor automatically, why do we need manuel?
Eyüp Can Turgut for good programming practice
Have you seen Codearchery.com teaser?
czcams.com/video/cqLdlBaohLU/video.html
Did you like it ?
Thanks Chinmay for replying to Eyup
bro ..only this sub teahing like this or other sub also have in this animated way...........if u know........... link me........plz........
Hi Girish,
Currently I am uploading videos of C++ and Data Structure only.
But In future I'll try to put every subject on CZcams :-)
By the way I like John Cena too :-)
yeah.......me2.....keep teaching like this way............tqu
G 5
Good explanation, but so annoying audio
data=-50 ,how?
sorry.. i got it
puhsadasdhahaha bu kadar kolay mıydı