182k views
5 votes
A reason to overload the ________ is to allow you to write classes that have array-like behaviors.

1 Answer

4 votes
I believe the answer is: square brackets [ ] operator

in C++, square brackets [ ] operator could be used to outputting an array in a class constructor that declared using pointers. The constructor should allocate an array and copy values from the pointer argument and should be returned in the element in the array you allocated.
User Cengkuru Michael
by
6.9k points