Originally Posted by
Subsonics
Thanks, unfortunately that moved the problem on to other errors like:
error: expected initializer before ‘struct’
error: expected constructor, destructor, or type conversion before ‘->’ token
Are you sure that you did it without any mistake?
This compiles fine.
ABC.h
Code:
#ifndef ABC_H_INCLUDED
#define ABC_H_INCLUDED
#include <cstddef>
template <class T> class ABC {
public:
struct node_t {
T data;
struct node_t *next;
};
node_t *new_node(T element);
};
#endif // ABC_H_INCLUDED
.cpp
Code:
#include "ABC.h"
//template <class T>
//typename ABC<T>::node_t *ABC<T>::node_node(T element)
template <class T>
typename ABC<T>::node_t *ABC<T>::new_node(T element) {
struct node_t *node = new struct node_t;
node->data = element;
node->next = NULL;
return node;
}
int main(void) {
return 0;
}