1.

Is It Possible To Pass An Object Of The Same Class In Place Of Object Reference To The Copy Constructor?

Answer»

Yes, when an object is created without the reference formal ARGUMENT, then the copy constructor is called for the argument object. The object that is passed as a parameter to the function is then passed as a parameter to the copy constructor.
For example:


In this CASE, the copy constructor is called for A2 while A1 is passed as a parameter to the copy constructor.

Yes, when an object is created without the reference formal argument, then the copy constructor is called for the argument object. The object that is passed as a parameter to the function is then passed as a parameter to the copy constructor.
For example:


In this case, the copy constructor is called for A2 while A1 is passed as a parameter to the copy constructor.



Discussion

No Comment Found