Stack in c++ template c++. See the main.cpp file.
never use 'Element' class. When I write 'element' or 'item' in comments I am refering to the same... that is, piece a information (type int, string, class, etc.)
-
Stack.tpp, Stack.h, Element.tpp Element.h are everything. Never separate, all in the same folder with main.cpp (file where you are going to work)
-
You Only have to import Stack.h like
Stack<typedate> nameWhatever;
stackname.top();
return top of stack
stackname.push(type item);
push item in stack
stackname.pop();
removes first element in stack and returns it
stackname.len();
return int, length stack
Compile main.cpp to see the tests or execute Main