using System;
namespace C7_99
{
public class Count
{
public static int count;
private int number;
public Count()
{
count = count + 1;
number = count;
}
public void show()
{
Console.WriteLine("object{0}:count={1}",number,count);
}
}
public class Program
{
public static void Main()
{
Count a = new Count();
a.show();
Console.WriteLine("---------");
Count b = new Count();
a.show();
b.show();
Console.WriteLine("---------");
Count c = new Count();
a.show();
b.show();
c.show();
}
}
}
沒有留言:
張貼留言