X
Xarky
Hi,
I have the following problem:
public class NodeList
{
public NodeList next;
private int data;
public NodeList(int x)
{
this.next = null;
this.data = x;
}
} // end class
Now in the main program, I have a instance of NodeList, which has data
stored on it(generally a minimum of 10 nodes).
NodeList myNodeList; // by following a trace, all data entered is
correct
Now I require an exact copy of that data but in another object, that
does not point to that instance.
NodeList myNodeList;
NodeList other;
When I do,
other = myNodeList; // both have the same data and point to the same
instance.
My problem is that I am deleting nodes from object other, and those
nodes are also being deleted from object myNodeList.
Can someone help me solve my problem.
Thanks in Advance
I have the following problem:
public class NodeList
{
public NodeList next;
private int data;
public NodeList(int x)
{
this.next = null;
this.data = x;
}
} // end class
Now in the main program, I have a instance of NodeList, which has data
stored on it(generally a minimum of 10 nodes).
NodeList myNodeList; // by following a trace, all data entered is
correct
Now I require an exact copy of that data but in another object, that
does not point to that instance.
NodeList myNodeList;
NodeList other;
When I do,
other = myNodeList; // both have the same data and point to the same
instance.
My problem is that I am deleting nodes from object other, and those
nodes are also being deleted from object myNodeList.
Can someone help me solve my problem.
Thanks in Advance