[求助]讲解运行程序结果
public class Class1{
Entry top;
public void Push(object data)
{
top=new Entry(top,data);
}
public object Pop()
{
if(top==null)throw new InvalidOperationException();
object result=top.data;
top=top.next;
return result;
}
class Entry
{
public Entry next;
public object data;
public Entry(Entry next,object data)
{
this.next=next;
this.data=data;
}
}
class Program
{
static void Main(string[] args)
{
Class1 s=new Class1();
s.Push(1);
s.Push(10);
s.Push(100);
s.Push(1000);
s.Pop();
s.Pop();
Console.WriteLine(s.Pop());
}
}
}
代码如上,请问输出结果为什么是10。