示例#1
0
        public void printList()
        {
            BackpackNode curr = head;

            while (curr != null)
            {
                Console.Write(" {0} ", curr.data.weaponName);
                curr = curr.next;
            }
            Console.WriteLine();
        }
示例#2
0
        public void addLast(Weapon b)
        {
            BackpackNode newNode = new BackpackNode(b);

            if (head == null)
            {
                head = newNode;
                return;
            }
            BackpackNode curr = head;

            while (curr.next != null)
            {
                curr = curr.next;
            }
            curr.next = newNode;
        }
示例#3
0
 public BackpackNode(Weapon b)
 {
     data = b;
     next = null;
 }
示例#4
0
 public Backpack(double m)
 {
     head          = null;
     maxWeight     = m;
     presentWeight = 0;
 }