1) You've got a memory leak with newarray since you never pair it with delete[ ].
2) If _arr is dynamically allocated 2-D array, each pointer within newarray now share the memory held by the pointers within _arr. When delete[ ] is used by newarray, it'll delete the memory held by _arr's pointers, leaving them dangling.
This is not 2D array... but it is a dynamic array of pointer to objects of Product class.
In line 7, i try to copy address of pointer to another dynamic array of pointer.
In line 11, i try to prevent memory leak but the addresses of pointers are already copied to newarray, so there should be no problem. Is my understanding correct?
Anyway, I still don't understand why there is a runtime error. :( Could you explain more to me :))
You probably fucked up an invariance. Use std::vector instead.
The error 'is not' there, but something that you did before. So, isolation and step by step debugging.
I guess that Product does not have a default constructor. To know how std::vector resolves that check out allocators (placement new)