a575963da9
Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
35 lines
361 B
C#
35 lines
361 B
C#
// Using an array of a type parameter.
|
|
|
|
class Stack<T>
|
|
{
|
|
int size;
|
|
T[] data;
|
|
|
|
public Stack ()
|
|
{
|
|
data = new T [200];
|
|
}
|
|
|
|
public void Push (T item)
|
|
{
|
|
data [size++] = item;
|
|
}
|
|
|
|
public T Pop ()
|
|
{
|
|
return data [--size];
|
|
}
|
|
|
|
public void Hello (T t)
|
|
{
|
|
System.Console.WriteLine ("Hello: {0}", t);
|
|
}
|
|
}
|
|
|
|
class Test
|
|
{
|
|
public static void Main ()
|
|
{
|
|
}
|
|
}
|