using System;
using System.Collections.Generic;
using System.Text;namespace console
{
    class one
    {
        public one()
        {
            System.Console.WriteLine("The one");
        }        ~one()
        {
        }
    }
    class two : one
    {
        public two()
        {
            System.Console.WriteLine("The two");
        }        ~two()
        {
        }    }    class three : two
    {
        public three()
        {
            System.Console.WriteLine("The three");
        }        ~three()
        {
        }
    }    class Program
    {
        static void Main(string[] args)
        {
            three t = new three();
            System.Console.ReadKey();
        }
    }
}

解决方案 »

  1.   

    你定义的是析构函数,不是构造函数,可以通过调用Collect强制进行垃圾回收,但大多数情况下应避免这样做,因为这样会导致性能问题
      

  2.   

    执行
    three t = new three();构造的顺序是
    The one
    The two
    The three
    析构的顺序就为
    The three
    The two
    The one
      

  3.   

    执行
    three t = new three();构造的顺序是
    The one
    The two
    The three
    析构的顺序就为
    The three
    The two
    The one
      

  4.   

    把Main中的Console.ReadLine()去掉输出结果和构造顺序相反
    The three
    The two
    The one