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 / preeti

There are 3 important places where a copy constructor is
called.

When an object is created from another object of the same
type
When an object is passed by value as a parameter to a
function
When an object is returned from a function

class A //With copy constructor
{
private:
char *name;
public:
A()
{
name = new char[20];
}
~A()
{
delete name[];
}
//Copy constructor
A(const A &b)
{
name = new char[20];
strcpy(name, b.name);
}
};

Is This Answer Correct ?    9 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is coupling in oop?

1084


What is abstract class in oop?

1065


What is the benefit of oop?

1103


Why do we use oops?

1071


Can a varargs method be overloaded?

1157


Why polymorphism is used in oops?

1106


What does and I oop and sksksk mean?

1231


Why oops is important?

1196


What is polymorphism what is it for and how is it used?

1058


What is object and class in oops?

1115


What is the full form of oops?

1245


What is constructor in oop?

1172


What is the difference between abstraction and polymorphism?

1158


How oops is better than procedural?

1149


What is debug class?what is trace class? What differences are between them? With examples.

2262