J
Joe
Hello, I don't know if it's appropriate to ask here.
But I am a C++ programmer, I think maybe you can more understand
what's my concerning.
I see the codes in Java to implement a linked list today.
I don't remember exactly what it is, just something like:
Class Node {
Element a;
Node next;
}
addNode(){
next = new Node;
}
What I know in C++, the line "Node next" is "Node* next".
I don't understand how this non-pointer writing could work. Isn't the
"next" object is allocate for a memory space when some instance of
class Node is created? Then there will be another node within the
next object, and another, and another....a infinit loop!
I don't understand.
Can anyone explain this?
But I am a C++ programmer, I think maybe you can more understand
what's my concerning.
I see the codes in Java to implement a linked list today.
I don't remember exactly what it is, just something like:
Class Node {
Element a;
Node next;
}
addNode(){
next = new Node;
}
What I know in C++, the line "Node next" is "Node* next".
I don't understand how this non-pointer writing could work. Isn't the
"next" object is allocate for a memory space when some instance of
class Node is created? Then there will be another node within the
next object, and another, and another....a infinit loop!
I don't understand.
Can anyone explain this?