Since Node is an inner class, you need to tell the compiler where the Node definition comes from.
In addition, the definition of Node changes depending on which parameter of the SList template (this is a dependent type)
So you should explicitly reference Node as such:
template<class T> typename SList<T>::NODE* SList<T>::sort(typename SList<T>::NODE* node) { //sorting algorithm }
- Pay attention to
typename , because Node is a dependent type (depends on the type of SList ) - Pay attention to
SList<T>::Node , because Node is a dependent type on SList .
source share