So my university exclusively teaches Java (a class on ada/prolog, but that's it). So I decided I needed to learn C++ on my own, so I've been going back and doing old java projects in C++.
The one I'm doing now is a simple resizeable stack implementation. It's the first of these projects I'm attempting, and I'm stuck on an array of objects.
I decided to just jump into it and use Templates, pointers, the whole 9 yards.
So here's my array declaration:
T* base; //our starting array, can be resized
and then later on in the constructor:
base = new T[max_size]; //init our array
which I think is the correct way to make an array of pointers. However I'm having issues compiling this method:
/*
Pushes an object onto our stack
*/
void push(T* object){
//check our stacks size
if(curr_index >= max_size)
resize(max_size + 3);
base[curr_index++] = object;
}
I know it's a dumb thing, but I can't seem to figure out nor could I find an example that I could understand.
Any help would be appreciated.