what is copy constructor?
when, why we use copy constructor??
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Rajeesh MenothRank #118 · 18.4K reputationPosted Jul 2, 2015, 8:06 PM EDT
Manj N144 reputationPosted Jul 2, 2015, 8:11 PM EDT
Gowtham KRank #65 · 26.5K reputationPosted Jul 2, 2015, 8:17 PM EDT
Sujeet SumanRank #790 · 2.9K reputationPosted Jul 2, 2015, 8:22 PM EDT
class Test
{
// Copy constructor.
public Test(Test previousTest)
{
Name = previousTest.Name;
Age = previousTest.Age;
}
}
RakeshRank #397 · 6.3K reputationPosted Jul 2, 2015, 8:50 PM EDT
Ken HRank #2,315 · 610 reputationPosted Aug 28, 2015, 1:59 AM EDT