Custom vector class not assigning values.

Pages: 12
Again, you can not mix new and delete with malloc/realloc and free.
realloc and free take a pointer parameter. That pointer must come from malloc/realloc. It cannot come from new.

Memory reserved with new must be released with delete.
Memory reserved with new[] must be released with delete[].

new does not only allocate memory. It constructs object to it.
delete does not only deallocate memory. It calls destructor of object before deallocation.
You won't notice this, if you test only with builtin types.
Topic archived. No new replies allowed.
Pages: 12