G
Guest
probably something really stupid but.... I have created a 2 classes
public class PegBoard
{
public int Status;
}
public class BFSPegBoardNode
{
public PegBoard[,] BFSBoard;
public int rowFrom;
public int colFrom;
}
I have created a new object of this type
BFSPegBoardNode CurrentNode = new BFSPegBoardNode();
push it on a Queue
MyMoveQueue.Enqueue(CurrentNode);
then deQueue later on
CurrentNode = (BFSPegBoardNode)(MyMoveQueue.Dequeue());
What is happening is that the objects that exist on the queue are being
changed when i edit CurrentNode
Keep in mind... i am looking at CurrentNode... Enqueueing... Still edit
CurrentNode... then trying to push a seaparate instance.. is this not how it
works? is the queue just a queue of pointers or is my object declaration
wrong?
public class PegBoard
{
public int Status;
}
public class BFSPegBoardNode
{
public PegBoard[,] BFSBoard;
public int rowFrom;
public int colFrom;
}
I have created a new object of this type
BFSPegBoardNode CurrentNode = new BFSPegBoardNode();
push it on a Queue
MyMoveQueue.Enqueue(CurrentNode);
then deQueue later on
CurrentNode = (BFSPegBoardNode)(MyMoveQueue.Dequeue());
What is happening is that the objects that exist on the queue are being
changed when i edit CurrentNode
Keep in mind... i am looking at CurrentNode... Enqueueing... Still edit
CurrentNode... then trying to push a seaparate instance.. is this not how it
works? is the queue just a queue of pointers or is my object declaration
wrong?