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
What is an interface in oop?
What is abstract class in oop?
design a c++ class for the chess board,provide a c++ class definition for such class(only class definition is required)
Is data hiding and abstraction same?
write a program to enter a string like"sunil is a good boy and seeking for a job" not more than 10 characters including space in one line,rest characters should b in other line.if the next line starts from in between the previous word,then print whole word to next line.
What is encapsulation with real life example?
How to improve object oriented design skills?
What is meant by multiple inheritance?
What is the problem with multiple inheritance?
How many human genes are polymorphic?
Can we create object of abstract class?
What are constructors in oop?
What is inheritance and how many types of inheritance?
How long to learn object oriented programming?
What is object-oriented programming? Webopedia definition