... 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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.