COPY CONSTRUCTOR IN C++ ( 33)

  Рет қаралды 78,986

Codearchery

Codearchery

Күн бұрын

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....
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...

Пікірлер
@Codearchery
@Codearchery 5 жыл бұрын
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.
@ashutosmisraa
@ashutosmisraa 3 жыл бұрын
Mayuri ne Popat kr diya js kiddin(. ❛ ᴗ ❛.)
@dhirajdarakhe3808
@dhirajdarakhe3808 3 жыл бұрын
Thanks
@thrishulh9834
@thrishulh9834 Ай бұрын
but in ur deep copy shallow copy video assignment operator is indeed invoking ur custom defined copy constructor
@Harsimran_Singh_27
@Harsimran_Singh_27 7 жыл бұрын
There are many C++ programming tutorials on KZbin 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 !!!
@Codearchery
@Codearchery 7 жыл бұрын
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
@cautioni
@cautioni 6 жыл бұрын
Don't stop. Keep uploading, understanding programming has never been this fun and easy.
@annonymousfox7515
@annonymousfox7515 6 жыл бұрын
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!
@Codearchery
@Codearchery 6 жыл бұрын
Thanks AnonymousFox Have you seen Codearchery.com teaser? kzbin.info/www/bejne/maKvlZ94ltSbgrc Did you like it ?
@imadvurkadinohinto
@imadvurkadinohinto 4 жыл бұрын
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.
@helios9595
@helios9595 Жыл бұрын
For The First Time in my life I enjoyed and very interested watch lectures. just keep going on dont change your style.
@rhitikkrishnani510
@rhitikkrishnani510 4 жыл бұрын
I am preparing for my placements. These lectures are really helpful. Thank you sir !!
@manishkumar1450
@manishkumar1450 5 жыл бұрын
crisp and clear approach of teaching.
@supersaiyanlimitbreaker3018
@supersaiyanlimitbreaker3018 7 жыл бұрын
Very well presented. easy to understand.
@mugiifeed6156
@mugiifeed6156 4 жыл бұрын
Love and respect from Sri Lanka,This is the Great Video series on C++
@theanger5930
@theanger5930 5 жыл бұрын
Despite the mistake you made, this video is just on point. You explained everything so well, thank you.
@shaikhtanzil2630
@shaikhtanzil2630 6 жыл бұрын
plz never stop making videos like this
@esabkhan7901
@esabkhan7901 4 жыл бұрын
You Know ,how to make people understand something , better than many.
@kirthikas1896
@kirthikas1896 3 жыл бұрын
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 !
@ramachandraudupi6641
@ramachandraudupi6641 6 жыл бұрын
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!!!!!!
@Pishkoo
@Pishkoo 3 жыл бұрын
Just wow...Superbly awesome 🥰
@yunaimenodacid5828
@yunaimenodacid5828 6 жыл бұрын
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.
@mohammadawaisrana8878
@mohammadawaisrana8878 3 жыл бұрын
Very nice teaching method😍
@IslamIslam-hd1ow
@IslamIslam-hd1ow Жыл бұрын
That's really helped me thank you
@usama57926
@usama57926 6 жыл бұрын
bro which software u use for making these videos
@mugiifeed6156
@mugiifeed6156 4 жыл бұрын
video scribe
@ariyanpritom9071
@ariyanpritom9071 Жыл бұрын
Yes Bro. Your video deserves LIKE.
@shivanigoswami2773
@shivanigoswami2773 4 жыл бұрын
Difference way unique explanation... Can easily understand all concept within 4 to 5 min only.thats a great video smart work I like.it👌👌👌👌
@areegahmed3926
@areegahmed3926 2 жыл бұрын
LITERALLY THE BESTTTT!!!!!!!!!
@vkj5742
@vkj5742 5 жыл бұрын
why have you written & symbol in the argument list of copy constructor? explain please.
@shivanigoswami2773
@shivanigoswami2773 4 жыл бұрын
Really I was enjoying it Fully satisfied for this concept in this way thank you
@shoaibkhairmuhammad9695
@shoaibkhairmuhammad9695 3 жыл бұрын
Why we use two variables x and data.. One is for copying other value?
@AlkaSharma391
@AlkaSharma391 5 жыл бұрын
Saw many videos but never see this type of video Amazing
@vanshikaanand3969
@vanshikaanand3969 6 жыл бұрын
isn't the second way of calling copy constructor '=' operator overloading??!
@tanveerasif5978
@tanveerasif5978 6 жыл бұрын
you didn't explain:- 1- Shallow copy n deep copy 2- Copy constructor parameter : why const specifier n pass by reference
@MASBHANOMAN
@MASBHANOMAN 7 жыл бұрын
really appreciated good work...
@Codearchery
@Codearchery 7 жыл бұрын
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
@Singikulam
@Singikulam 5 жыл бұрын
C
@abrahamyalley9973
@abrahamyalley9973 3 жыл бұрын
BEAUTIFUL!!
@poojasalvi1262
@poojasalvi1262 4 жыл бұрын
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.....🙏👍
@mohansrikri
@mohansrikri 7 жыл бұрын
Can you explain shallow copy and deep copy concepts...
@Codearchery
@Codearchery 7 жыл бұрын
Yeah why not , I will be uploading the videos in upcoming few days
@sanketsharma7141
@sanketsharma7141 6 жыл бұрын
So amazing.... Superb....Kya KZbinr h yr....
@usama57926
@usama57926 6 жыл бұрын
u r great explanier
@samaryadav7208
@samaryadav7208 7 жыл бұрын
@2:34 is assignment operator NOT copy constructor. Else it is a great video.
@JeesJoy
@JeesJoy 6 жыл бұрын
Samar Yadav it is a copy constructor
@rashidakhatun7437
@rashidakhatun7437 6 жыл бұрын
Thanks a lot
@poojasalvi1262
@poojasalvi1262 4 жыл бұрын
How to practice c++ programming to clear each & every concepts & also how to develop logic pls tell me sir.....🙏👍
@Shubham-xh9nz
@Shubham-xh9nz 7 жыл бұрын
3:06 whats that example ( example & data){ data = dummy.data } is syntax of copy constructer ? Or something else
@Codearchery
@Codearchery 7 жыл бұрын
You got it right , this one is the syntax of copy constructor
@nawalkishoresingh4794
@nawalkishoresingh4794 6 жыл бұрын
Nice video. But copy constructor manually is not clear to me. Any video reference for understanding copy constructor manually , for clearing our concept
@rushdaquraishi2206
@rushdaquraishi2206 6 жыл бұрын
Really awesome way to teach using animation. I love it keep updating
@michaelvela2835
@michaelvela2835 3 жыл бұрын
Great video!
@ganeshbhavana1061
@ganeshbhavana1061 4 жыл бұрын
I appreciate u r work
@QuickTale55
@QuickTale55 5 жыл бұрын
Tks for a good video
@SanthoshAS-x6u
@SanthoshAS-x6u Жыл бұрын
but what is the use '&' in copy operator???
@paridhimodi2450
@paridhimodi2450 7 жыл бұрын
i never get what my teacher teaches in skul. but aftr watching your videos i understood everything written in book
@Codearchery
@Codearchery 7 жыл бұрын
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
@paridhimodi2450
@paridhimodi2450 7 жыл бұрын
hahaha for sure
@paridhimodi2450
@paridhimodi2450 7 жыл бұрын
never mind
@paridhimodi2450
@paridhimodi2450 7 жыл бұрын
can you pls upload videos of pointers
@xxkingcoreyxx5499
@xxkingcoreyxx5499 6 жыл бұрын
yoooo nice job,good work man please carry on
@deepakborah8335
@deepakborah8335 7 жыл бұрын
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.?
@anyk.3741
@anyk.3741 7 жыл бұрын
I'm confused . Example obj2; obj2 =obj 1 ; how does this involves copy constructor as object is not copyed at construction.
@samaryadav7208
@samaryadav7208 7 жыл бұрын
it's not. He made a mistake. It is actually assignment operator.
@sarveshkaran9380
@sarveshkaran9380 5 жыл бұрын
right its assignment operator call,not copy constructor
@saurabhs4743
@saurabhs4743 6 жыл бұрын
Why does the default contructor have access specifier?
@amerbangla7256
@amerbangla7256 6 жыл бұрын
great job dear just outstanding tutorials
@ahmedalaa9214
@ahmedalaa9214 Жыл бұрын
I hope all the best for you ❤️
@Haxr-dq6wt
@Haxr-dq6wt 7 жыл бұрын
my brother you are the best instructor on youtube i want to be your friend on facebook
@divyasammeta4383
@divyasammeta4383 6 жыл бұрын
Can u give brief on non parameterised with syntax and program
@r_m5545
@r_m5545 4 жыл бұрын
Thanks a lot man
@RahulKumar-tf8uq
@RahulKumar-tf8uq 7 жыл бұрын
good concept.. i like the way you teach
@Codearchery
@Codearchery 7 жыл бұрын
Thanks a lot Rahul , I hope you'll love to share this channel with your friends too . Keep on Watching and learning :-)
@Vishakitha
@Vishakitha Жыл бұрын
Why some programs in use int main() then some programs in use void main() if I wrote the program how I choose main() bro
@exoticme4760
@exoticme4760 6 жыл бұрын
as always SUPERB !
@Gurpreet11g
@Gurpreet11g 5 ай бұрын
Sir pls make video on type conversion -basic to class, class to basic or class to class.
@jattsuryanshchoudhary6927
@jattsuryanshchoudhary6927 7 жыл бұрын
sir small doubt in copy constructor defining... data=dummy.data this line is not properly clear
@Codearchery
@Codearchery 7 жыл бұрын
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:-)
@cyborgdale
@cyborgdale 7 жыл бұрын
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?
@joeydicastro
@joeydicastro 6 жыл бұрын
Very good video and so funny, btw it is always a good practice to set copy constructor params as const reference :)
@Ms_Priya26
@Ms_Priya26 4 жыл бұрын
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
@احمدسليم-ن4ل
@احمدسليم-ن4ل 4 жыл бұрын
Very good
@theradhikagupta
@theradhikagupta 6 жыл бұрын
Please make videos of c++ 11 and c++14 concepts
@usama57926
@usama57926 6 жыл бұрын
thank u very much
@anshkevadiya8731
@anshkevadiya8731 3 жыл бұрын
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
@dude5697
@dude5697 5 жыл бұрын
What does end1 mean?
@southparkclips221
@southparkclips221 3 жыл бұрын
Ya deserve a like!!
@aafreengundigara8898
@aafreengundigara8898 5 жыл бұрын
Perfect explain👍
@mohitweekendvlogs
@mohitweekendvlogs 7 жыл бұрын
One day this channel have millions of subscribers .
@kavinashokan5692
@kavinashokan5692 5 жыл бұрын
Uses of copy constructors?
@dhrinsagrawal9057
@dhrinsagrawal9057 10 ай бұрын
Thanks
@Arnob127
@Arnob127 4 жыл бұрын
Epic!
@vellyjatt7824
@vellyjatt7824 6 жыл бұрын
From which country you are?
@vellyjatt7824
@vellyjatt7824 6 жыл бұрын
Nice work
@eyupcan1831
@eyupcan1831 6 жыл бұрын
If we can make a copy constructor automatically, why do we need manuel?
@chinmaykulkarni2897
@chinmaykulkarni2897 6 жыл бұрын
Eyüp Can Turgut for good programming practice
@Codearchery
@Codearchery 6 жыл бұрын
Have you seen Codearchery.com teaser? kzbin.info/www/bejne/maKvlZ94ltSbgrc Did you like it ?
@Codearchery
@Codearchery 6 жыл бұрын
Thanks Chinmay for replying to Eyup
@keepitsimplesonu
@keepitsimplesonu 3 жыл бұрын
Methodology 🙌🏻❤
@JeesJoy
@JeesJoy 6 жыл бұрын
Very useful!.keep making videos like this😍
@prathamsharma6368
@prathamsharma6368 7 жыл бұрын
very good
@Codearchery
@Codearchery 7 жыл бұрын
Thanks Pratham Plz Share My Videos with your friends
@junaidsatti5012
@junaidsatti5012 7 жыл бұрын
Thank Good Video
@Codearchery
@Codearchery 7 жыл бұрын
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
@jattsuryanshchoudhary6927
@jattsuryanshchoudhary6927 7 жыл бұрын
Sir mje book 📖 S bilkul smj ni aaaa ra ta... you helped me alot
@Codearchery
@Codearchery 7 жыл бұрын
Do this for every Concept. First Watch my Video and then read the book :-) And you will understand everything
@giriminati
@giriminati 7 жыл бұрын
bro ..only this sub teahing like this or other sub also have in this animated way...........if u know........... link me........plz........
@Codearchery
@Codearchery 7 жыл бұрын
Hi Girish, Currently I am uploading videos of C++ and Data Structure only. But In future I'll try to put every subject on KZbin :-) By the way I like John Cena too :-)
@giriminati
@giriminati 7 жыл бұрын
yeah.......me2.....keep teaching like this way............tqu
@teen_shine_6239
@teen_shine_6239 6 жыл бұрын
Best
@kri7teen
@kri7teen 2 жыл бұрын
Good explanation, but so annoying audio
@lokeshthakre9500
@lokeshthakre9500 6 жыл бұрын
data=-50 ,how?
@lokeshthakre9500
@lokeshthakre9500 6 жыл бұрын
sorry.. i got it
@emrebilgis
@emrebilgis 2 жыл бұрын
puhsadasdhahaha bu kadar kolay mıydı
@samiulislamdurjoy
@samiulislamdurjoy 4 жыл бұрын
G 5
@douchelick7263
@douchelick7263 5 жыл бұрын
@suhaibkorg
@suhaibkorg 6 ай бұрын
thanks a lot
DESTRUCTOR IN C++ (34)
4:03
Codearchery
Рет қаралды 43 М.
Copying and Copy Constructors in C++
20:52
The Cherno
Рет қаралды 431 М.
World‘s Strongest Man VS Apple
01:00
Browney
Рет қаралды 39 МЛН
Сюрприз для Златы на день рождения
00:10
Victoria Portfolio
Рет қаралды 1,3 МЛН
Good teacher wows kids with practical examples #shorts
00:32
I migliori trucchetti di Fabiosa
Рет қаралды 12 МЛН
Seja Gentil com os Pequenos Animais 😿
00:20
Los Wagners
Рет қаралды 13 МЛН
C++ CLASSES & OBJECTS explained easy 🧍
10:54
Bro Code
Рет қаралды 22 М.
C++ class copy constructor  [3]
8:13
Professor Hank Stalica
Рет қаралды 4,2 М.
Inheritance in C++
8:00
The Cherno
Рет қаралды 391 М.
Every Programming Language Ever Explained in 15 Minutes
15:29
Flash Bytes
Рет қаралды 337 М.
C++ vs Rust: which is faster?
21:15
fasterthanlime
Рет қаралды 398 М.
C++ CONSTRUCTORS explained easy 👷
8:55
Bro Code
Рет қаралды 17 М.
World‘s Strongest Man VS Apple
01:00
Browney
Рет қаралды 39 МЛН