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
What is flush programming?
Explain the difference between using macro and inline functions?
What is the size of integer variable?
Do the parentheses after the type name make a difference with new?
Is c++ low level?
Write a program to find the reverse Fibonacci series starting from N.
What are c++ manipulators?
You want to link a c++ program to c functions. How would you do it?
When the constructor of a base class calls a virtual function, why doesn't the override function of the derived class gets called?
What does obj stand for?
What happens when the extern "c" char func (char*,waste) executes?
Explain the volatile and mutable keywords.
Differentiate between late binding and early binding.
Are c and c++ different?
What do manipulators do?