Can copy constructor admit an object of the same class , C/C++ Programming

Can copy constructor admit an object of the same class as parameter, rather than reference of the object?

 

Posted Date: 3/15/2013 4:04:42 AM | Location : United States





A: No. this is specified in the definition of the copy constructor itself. It must generate an error if a programmer specifies a copy constructor along a first argument that is an object and not a reference.

 

Posted by | Posted Date: 3/15/2013 4:06:03 AM

constructor with a single argument creates that constructor as conversion ctor and it can be utilized for type conversion.

For instance:

class Boo

{

public:

Boo ( int i );

};

Boo BooObject = 10; // assigning int 10 Boo object

 

Posted by | Posted Date: 3/15/2013 4:07:19 AM


Related Discussions:- Can copy constructor admit an object of the same class , Assignment Help, Ask Question on Can copy constructor admit an object of the same class , Get Answer, Expert's Help, Can copy constructor admit an object of the same class Discussions

Write discussion on Can copy constructor admit an object of the same class
Your posts are moderated
Related Questions
I''m having trouble with my C code to red from a Hash table. Not sure what it is I''m doing wrong and stumped. I need to get it figured out by tomorrow at 4:00 p.m. Eastern time. C

Define the Classification of Operators in C Language? Depending on the function performed the operator can be classified as 1. Arithmetic Operator 2. Logical Operator 3. Inc

to calculate the amount to be paid by a customer buying yummy cupcakes for his birth day party

What are the debugging methods you employ while came across a problem? A: Debugging with tools such as: 1.      DBG, GDB ,Forte, Visual Studio. 2.      Using tusc to trace

need to create c++ classes to store all pascal types in compiler design.

Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve between two points can b

Write a function to accept a character and display it 40 times.

The interest charged on a loan banking facility is calculated based on principal amount, rate and time. implement a C program that can be used to automate the calculation of the in

Public, Private and Protected members: Class members can either be declared in public','protected' or in the 'private' sections of the class. But as one of the features of OOP i

padovan string generation till 40