Exemplo n.º 1
0
        private int valueWrite(ClassTest ct)
        {
            int ilocalVraiable = 0;

            ct.itest = ilocalVraiable;

            return(ct.itest);
        }
Exemplo n.º 2
0
        public Form2()
        {
            InitializeComponent();
            Init();
            ClassTest test = new ClassTest();

            test.test();
            //object[] oary = test.showEnum();
            foreach (int i in test.showEnum())
            {
                Console.WriteLine();
            }

            Console.WriteLine(test.showNum());
        }
Exemplo n.º 3
0
        private void InitVariable()
        {
            //验证值传递和引用传递
            //值传递 : 传递的实参的值,改变的是形参的值
            //引用传递 : 传递的实参的地址,改变的是形参的值,同时实参的值也发生改变
            int i = 5;

            Console.WriteLine(valueWrite(i));
            Console.WriteLine(i);
            ClassTest ct = new ClassTest();

            ct.itest = 5;
            Console.WriteLine(valueWrite(ct));
            Console.WriteLine(ct.itest);

            /*0
             * 5
             * 0
             * 0*/
        }