Write three distinct situations in which copy constructor of a-00477
This subjective question is related to the book/course vu cs302 Digital Logic Design. It can also be found in vu cs302 Mid Term Solved Past Paper No. 2.
Question 1: Write three distinct situations in which copy constructor of a class is called.
Answer:
- Assignment of private data members at the time of object creation.
- When an object is passed by vale to a function.
- When allocating memory dynamically we use copy constructor to avoid dangling pointer issue.