【发布时间】:2013-11-20 05:42:08
【问题描述】:
我在一本书中遇到了这个单链表实现。但是,我不明白一些说法。我对每个陈述的问题都针对每个陈述列出。
1 class Node {
2 Node next = null; //Is this a constructor?
3 int data;
4 public Node(int d) { data = d; }
5 void appendToTail(int d) {
6 Node end = new Node(d);
7 Node n = this;//Why is "this" keyword used here? What does this do?
8 while (n.next != null) { n = n.next; }//Where does "next" member come from?
9 n.next = end;
10 }
11 }
【问题讨论】:
标签: c# singly-linked-list