Home > Back-end >  Novice C class member function definition of doubt
Novice C class member function definition of doubt

Time:09-21

In writing is singly linked list data structure problems, the following code in my outside the class definition getnode function, where the grammar wrong?

If I want to put the struct Node's statement in the private, I again how to outside the class defines a return value is the function of Node *? Or say if do like this Node must be declared in public?

Bosses give directions,

 template The class List 
{
Public:
Struct Node
{
T data;
Node * next;
};
Data Node * getnode (T);
Private:
Int length;
Node * head;
Node * p;
};
The template & lt; Typename T> List : : Node * List : : getnode (T, n)

CodePudding user response:

Ah, the last line is I want to define the function, forgot to write the {}

CodePudding user response:

The friend function,,,
  • Related