The plan is to add a new method 'resize' where a new array will copy the contents of the first original array and modify the already existing 'add' method to call 'resize' when necessary.
Up till now, in the constructor I created the new array, what do you guys think? good idea? should I give the array a default value?
You should allow it to be created with a default ctor, giving it a default size. Also, what is the purpose of newsize in your constructor? I see you commented out the line that used it, but was your logic behind it at all?
So yes, create a method that allocates a new chunk of memory and copies your old array into this new space. Or moves with std::move.
Well I was thinking of using 'newsize' in order to have a dynamic size array. What I'm trying to say is that the new array should be able to change depending on the number of items added, to my understanding, it should not have a default size.
And I'm suppose to use a copy function, since we haven't learned anything about 'move'.
That 'newsize' should be used in the resize method in order to create a dynamic size array
I think OP is trying to write his own vector. Unless I'm mistaken?
If this is what you're trying to do then you should provide a default ctor that creates an array of default size. Then just have a reallocate method that allocates capacity * 2 blocks, then copy the old array over to this new space.