Use app×
Join Bloom Tuition
One on One Online Tuition
JEE MAIN 2025 Foundation Course
NEET 2025 Foundation Course
CLASS 12 FOUNDATION COURSE
CLASS 10 FOUNDATION COURSE
CLASS 9 FOUNDATION COURSE
CLASS 8 FOUNDATION COURSE
0 votes
5.5k views
in Computer by (49.7k points)

Explain the features of copy constructor.

1 Answer

+1 vote
by (49.6k points)
selected by
 
Best answer

The features of copy constructors are

  • copy constructor is a special type of parameterized constructor.
  • It is normally used to copy one object into another.
  • They are normally used to initialize object with values of already existing object.
  • Copy constructors should have at least one argument of the same class and must be passed as a constant reference type.
  • The copy constructor cannot be invoked explicitly but can be equated to an already existing object in the declaration itself.

For example:
x a1; _ _ _ default constructor invoked
X a2 = a1; _ _ _ copy constructor invoked.
The C++ compiler creates default copy constructor automatically.

Welcome to Sarthaks eConnect: A unique platform where students can interact with teachers/experts/students to get solutions to their queries. Students (upto class 10+2) preparing for All Government Exams, CBSE Board Exam, ICSE Board Exam, State Board Exam, JEE (Mains+Advance) and NEET can ask questions from any subject and get quick answers by subject teachers/ experts/mentors/students.

Categories

...