Hello to all, can anyone please explain to me the following: I know how to use the copy constructor, I know that it's used only in the initialization, when i wanna initialize a new object using an old object... But what I don't understand is how will I know when I have the need to do this - "initialize a new object using an old object" ? How will i recognize the need of using the copy constructor ?
robertmacedonia
0
Junior Poster in Training
Recommended Answers
Jump to PostYou're asking the wrong question. The compiler will attempt to invoke a copy constructor (assuming one exists) upon any attempt to create a copy of an object.
The real practical concern is whether you need to write the copy constructor yourself or let the compiler do it for you.
…
Jump to PostSmall addition.
Question: how will I know when I have the need to do this:double pi = 3.14159265358;
Answer: YOU know when and why...
It's the same case.Also you are using copy constructor implicitly when you pass an object as a function argument by …
All 5 Replies
grumpier
149
Posting Whiz in Training
ArkM
1,090
Postaholic
anushri
0
Newbie Poster
skhandre02
0
Newbie Poster
mrnutty
761
Senior Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.