class struct

{
    class clsA
    {
        private int _i;
        public int I 
        {
            set { _i = value; }
            get { return _i; } 
        }
    }

    struct strctB
    {
        private int _i;
        public int I
        {
            set { _i = value; }
            get { return _i; }
        }
    }

    class Program
    {
        static void Main(string[] args)
        {
            clsA a1=new clsA();
            a1.I=1;
            clsA a2=a1;
            a2.I=2;
            Console.WriteLine("{0},{1}", a1.I, a2.I);//2,2
            strctB b1=new strctB();
            b1.I = 1;
            strctB b2=b1;
            b2.I = 2;
            Console.WriteLine("{0},{1}", b1.I, b2.I);//1,2
        }
    }
}

 

posted @ 2017-04-18 14:35  sky20080101  阅读(141)  评论(0编辑  收藏  举报