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
Your program should use the Free Pascal compiler or the Lazarus IDE described in CSC 540. When you hand in your assignment to the digital dropbox, it should be a .PAS file, not zip

Write a program consisting of two functions (plus main). The first function should read in a number and then pass this back to main. This value should then be passed into a secon

Use the program called harris-shell.c and add some code to find the corners in the image checkers.jpg. You should say that a pixel in the image is a corner if it passes the given t

Given an char variable last that has been initialized to a lowercase letter, write a loop that displays all possible combinations of two letters in the range ''a'' through last. Th


Write algorithm and program for the conversion of a Tree to a Binary Tree

Draw pie chart in c++ program: int main() {                 char cmd;                   cout                 cout                 cmd = toupper(getch());

Write a C program to compute the factorial of  5 i.e 1x2x3x4x5 etc #include stdio.h   void main()   {   char promt;      int factor;   factor = 1*2*3*4*5;   printf("The fac

Problem 1. Explain Break and continue statements in C++. Explanation of Break statement Explanation of Continue statement 2. Explain concepts of constructors and

Project Description: I am trading binary options and need my signals that are sent to me via email to be sent to my followers via an RSS feed I have no idea how rss feeds imp