Question
Easy

What is a copy constructor ?

1
A constructor that allows a user to move data from one object to another.
2
A constructor to initialize an object with the values of another object.
3
A constructor to check whether objects are equal or not.
4
A constructor to delete other copies of a given object.
Question Details
Time to Solve: 12
Exam: HTET
Level/Paper: Level 3
Chapter: Object-Oriented Programming (C++)
Topic: Advanced Class Concepts
Correct Answer
Option B
Explanation

The correct option is (2): A copy constructor is a special type of constructor in Object-Oriented Programming, particularly in languages like C++, that is specifically designed to create a new object as an exact copy of an already existing object of the same class. Its fundamental role is to perform initialization, meaning it sets the initial state of the newly created object by copying the data member values from a…Read More

What is a copy - HTET Level 3 | Clear Cutoff