hello
what's the correct synthax for a function implementation which will return a private struct pointer?
Below, in green there is the type I want to be returned by the function insert.
In red the obvoius synthax error, since sNode belongs to cTree's scope.
edit: unclarity code correction
I've triedCode:template <class T>
class cTree {
private:
struct sNode {
...
};
sNode* insert (sNode*, T&);
...
public:
...
};
//function implementation
template <class T>
sNode* cTree<T>::insert (sNode* node, T& data) {
sNode *tmp;
...
return tmp;
}
but g++ gives me the same error: expected constructor, destructor, or type conversion before ‘*’ tokenCode:cTree<T>::sNode* cTree<T>::insert (sNode* node, T& data) {
I've also tried other "solutions" with no success and I'm still searching for a link with the right answer.
If anybody can help, thanks