I'm currently rewriting a class definition (with it's member functions) to be a class template. To summarize the program, I am writing my own stack class in which my assignment originally had us build the stack class to only accept ints as the data type. Needless to say, now we are modifying it to allow for any data type to be stored.
My question isn't necessarily a problem with my code as I have tested it and it seems to work flawlessly with the test code we were given for the first phase of this assignment. What I am wondering is if there is a simpler way for me to do my member functions; what I found when modifying this program was that for every single member function I was having to include
1 2
template <class T>
return_type class <data_type> :: functionName(function parameters)
The same was true for my overloaded operators, for example my assignment operator looks like this right now:
That is an option, but I think my teacher wants only prototypes within the class and no actual declarations. Oh well, my code works, I was just wondering if I had missed something obvious