Hi I am from a Java background and quite new to C++ In my intermediate level of Java programming i never had situation where i declared an object of some class within the body of that class, now am studying linked lists in C++, here in this code and in several other places i have come across that pointer to that class/struct is declared within its body i.e Struct ListNode * next; in the following code
private:
// Declare a structure for the list
structListNode{
float value;
structListNode*next;
};
ListNode*head; // List head pointer
public:
FloatList(void) { // Constructor
head = NULL;
}
~FloatList(void) { }; // Destructor
void appendNode(float);
void displayList(void);
void deleteNode(float);
};
or Node * next ; in this code below
class Node {
int data; // The value stored in node
Node* next; // The address of next node
}
I can'really comprehend what it means or how is it going , can someone please explain it to me?