Answer Posted / amar
Copy constructors is used in following cases.
1) When object is passed by values to a fucntion
2) when function returns object by value
3) When new object is created from exixting object using
overlaoded = operator.
If user has not defined its own copy constructor, compiler
synthesised constructor would be called which will do
shallow copy. So if you have pointer in your class then only
the pointer value is copied and not the contents which
pointer points to.
Is This Answer Correct ? | 12 Yes | 5 No |
Post New Answer View All Answers
write a function signature with various number of parameters.
What will happen if a pointer is deleted twice?
Explain how we implement exception handling in c++?
How would you use the functions memcpy(), memset(), memmove()?
What is virtual table?
What is the latest c++ version?
Explain virtual destructor?
Why is c++ still used?
What are arithmetic operators?
Define friend function.
What is abstract keyword in c++?
Would you rather wait for quicksort, linear search, or bubble sort on a 200000 element array? (Or go to lunch...) a) Quicksort b) Linear Search c) Bubble Sort
What is an undefined behavior and sequence points
If dog is a friend of boy, is boy a friend of dog?
What are static and dynamic type checking?