 |
Assignment operator (C++) - Wikipedia, the free encyclopedia
class My_Array {int * array; int count; public: My_Array & operator = (const My_Array & other) {if (this! = & other) // protect against invalid self-assignment {// 1: allocate new memory and copy the elements int * new_array = new int [other. count]; std:
en.wikipedia.org |
 |