Answer Posted / achal ubbott
Question on copy constructor is a classic one for an
interview. Since most modern day c++ compilers provide a
default copy constructor, most people don't get to try
hands over it. But in some cases it becomes mandatory to
define your own copy constructor and override the default
one.
So the places when CC is invoked are:-
1. calling a function e.g. void f(sample A);
2. creating an object from the existing object.
e.g. sample A=B; // here B is existing object.
3. When a function returns a copy of object.
e.g. sample f()
{
sample a;
return a;
}
| Is This Answer Correct ? | 2 Yes | 0 No |
Post New Answer View All Answers
How to call a non virtual function in the derived class by using base class pointer
How do you achieve polymorphism?
Can you inherit a private class?
Hi friends I have experience of 6 months in website design and maintanence. Now i am looking for other IT jobs.. to switch platform. please post any interview you know in chennai.
What is the real time example of inheritance?
What is the purpose of enum?
Why is object oriented programming so hard?
Why is encapsulation used?
What are the 3 pillars of oop?
which feature are not hold visual basic of oop?
What is the difference between abstraction and polymorphism?
What is a function in oop?
Will I be able to get a picture in D drive to the c++ program? If so, help me out?
What is abstraction in oops?
What is abstraction with example?