Stack類代碼:
01
using
System;
02
//using System.Collections.Generic;
03
using
System.Text;
04
using
System.Collections;
05
06
namespace
StackHelper
07
{
08
class
StackHelper
09
{
10
private
Stack list;
11
public
Stack List
12
{
13
set
{ list = value; }
14
get
{
return
list; }
15
}
16
public
StackHelper()
17
{
18
list =
new
Stack();
//注意:不是list=new StackHelper()
19
Console.WriteLine(
"---------Stack-----------"
);
20
}
21
//壓入一個元素
22
public
void
Add(
object
o)
23
{
24
list.Push(o);
25
Console.WriteLine(
"壓入 元素:{0}"
,o);
26
}
27
//刪除棧頂元素
28
&n