Is it possible to set up a stack class (last-in -> first-out linked list, basically) in which the nodes can contain data of whatever type the user of the class wishes?
Printable View
Is it possible to set up a stack class (last-in -> first-out linked list, basically) in which the nodes can contain data of whatever type the user of the class wishes?
Yes. In C you would use void pointers (messy), in C++ templates. In fact it's already done: the std::stack template in the file <stack> is part of the C++ standard template library and available on every compiler.