... receives as its argument a const Array& to an Array. The function outputs the number of elements in its Array argument and the contents of the Array. In this case, the size of the Array is 7, so seven 0s are output.

Line 12 calls function outputArray with the int value 3 as an argument. However, this program does not contain a function called outputArray that takes an int argument. So, the compiler determines whether the argument 3 can be converted to an Array object. Because class Array provides a constructor with one int argument and that constructor is not declared explicit, the compiler assumes the constructor is a conversion constructor and uses it to convert the argument 3 into a temporary Array object containing three elements. Then, the ...

Get C++ How to Program, 10/e now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.