Here is a code of a class of Linked List , i have a question on the function Singly_linked_list *GetNext()
.What does that means if a class name is stated before the function name? Is that a data type?Also,same question on the data member Singly_linked_list *nextPtr
.I Please help
Thank you
class Singly_linked_list // Use a class Singly_linked_list to represent an object{
public:
// constructor initialize the nextPtr
Singly_linked_list()
{
nextPtr = 0; // point to null at the beginning
}
// get a number
int GetNum()
{
return number;
}
// set a number
void SetNum(int num)
{
number = num;
}
// get the next pointer
Singly_linked_list *GetNext()
{
return nextPtr;
}
// set the next pointer
void SetNext(Singly_linked_list *ptr)
{
nextPtr = ptr;
}
private:
int number;
Singly_linked_list *nextPtr;
};