Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

WHEN A COPY CONSTER IS CALL ?

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


Please Help Members By Posting Answers For Below Questions

can inline function declare in private part of class?

4303


what type of questions

2065


How is polymorphism achieved?

1000


They started with the brief introduction followed by few basic C++ questions on polumorphism, inheritance and then virtual functions. What is polymorphims? How you will access polymorphic functions in C? How virtual function mechanism works?

1864


what is the sylabus for priliminaries?

2122


What is abstraction in oops with example?

1217


What is object and example?

1113


Write a C++ program without using any loop (if, for, while etc) to print prime numbers from 1 to 100 and 100 to 1 (Do not use 200 print statements!!!)

2042


What is property in oops?

988


Can a varargs method be overloaded?

1038


What is encapsulation in simple terms?

975


What is object in oop?

1061


What is a function in oop?

1019


Why is polymorphism needed?

1002


write a programe to calculate the simple intrest and compund intrest using by function overlading

2130