[转载]静态构造函数


    class Program
    
{
        
static void Main(string[] args)
        
{
            Caculator ca 
= new Caculator();
            Caculator ca1 
= new Caculator();
            Console.WriteLine(
"Current object count is : " + Caculator.InstanceCount.ToString());
            Console.ReadLine();
        }

    }


    
public class Caculator
    
{
        
public static int InstanceCount;
        
static Caculator()
        
{
            InstanceCount
++;
        }

        
public Caculator()
        
{
            InstanceCount
++;
        }

    }
这个的输出结果是多少呢~~~

3
posted @ 2008-05-06 11:53  RobotTech  阅读(176)  评论(0编辑  收藏  举报