So I've been working on implementing a stack data structure as an ADT, the program compiles, but when I try and push elements on top of the stack, for some reason the stack is full. Can anyone help? Thank you in advance.
You are mixing templates and inheritance polymophism.
An ADT is typically not polymorphic, it's usually a concretet type (like FILE) or a template (like stack<T>).
Thinking is a stack algorithm is exactly the same, irrespective of what type is bing stacked. Inheritance implies that the derived thing is a little different from the base.
@Zhuge, thank you, that fixed it, I was staring at the push function for over an hour.
@kbw The reason I'm making the stack an ADT is because I'm implementing it as an array in the above example, and then going to implement it as a linked list and doubly linked list. It doesn't necessarily have to be abstract, would there be a more efficient way?
In engineering, everything's a trade off. The polymorphic approach generates a vtable per class and indirection on each call. The template approach generates an entire new class for each time, this used to be called code-bloat, but this is the method most often use.
You are mixing both methods, so it seems a little confused.