tell about copy constructor

Answer Posted / madhu

Basic thing, copy constructor will be called whenever a copy
is made. and copy constructors are called when:
1. create a new object using existing object.
2. When is returning to caller.
3. When an object is passed by value as a parameter to a
function

Basically a default copy constructor will be created which
does bitwise copy also know as shallow copy.
This will become a problem when we are dealing with dynamic
memory allocation for variables and leads to dangling pointer.
To overcome we have to override by deep copy.

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

when to use 'mutable' keyword and when to use 'const cast' in c++

1642


What is object and example?

602


What are the advantages of polymorphism?

574


How do you explain polymorphism?

590


What is abstract class in oops?

600






what type of question are asked in thoughtworks pair programming round ?

1761


Why we use classes in oop?

580


Plese get me a perfect C++ program for railway/airway reservation with all details.

3427


Explain virtual inheritance?

682


What does <> mean pseudocode?

622


Can main method override?

583


Why do we need oop?

671


What are benefits of oop?

638


write a program using c++ to implement single contiguous memory mangement techniques.display the content of the main memory after yhe allocation of jobs and percentage of the wastage of the main memory

2759


which feature are not hold visual basic of oop?

1723