A copy constructor has the same name as the class (let’s call it A) and has a parameter that

a. Is call-by value of an A object
b. Is call-by-reference of another class
c. Is call-by-reference of an A class object
d. Is call-by-name of an object named ~A.
e. None of these

c is the closest. It is preferable to have a const call-by-reference parameter
of class A type..
Explanation: The reference is to break the recursion of A(A object) if a call-by-value were used. What happens is you are passing A object by value, this calls the copy constructor, which has an A object called by value which … and so on. Early C++ compilers would crash, using all of memory if you left out the &. Modern compilers in my experience catch this error.

Computer Science & Information Technology

You might also like to view...

Answer the following questions true (T) or false (F)

1. If two programs perform the same task, then the faster program is always better. 2. A module indicates that an error has occurred by catching an exception. 3. Syntax errors are corrected during the maintenance phase of the software life cycle.

Computer Science & Information Technology

An Activity is launched by using a(n) ________ that indicates an action to be performed and the data on which to perform that action.

a. Action b. IntendedAction c. Launcher d. Intent

Computer Science & Information Technology