Ejemplo n.º 1
0
        public static void ClassTest()
        {
            /*
             * // < class Consturctor with new >
             *
             * 1.	new Type 뒤에는 반드시 (), [], {}가 필요하다.
             *      new Type(...)
             *      new Type[...]
             *      new Type{...}
             *
             * 2.	클래스의 암시적 기본 생성자는 모든 멤버 데이터를 0 or null로 초기화한다.
             */

            {
                CTest t = new CTest(1);
                Console.WriteLine("CTest m_Value: {0}, {1}", t.m_Value1, t.m_Value2);

                foreach (int i in t)
                {
                    Console.WriteLine("{0}", i);
                }

                foreach (int i in t.DoForeach())
                {
                    Console.WriteLine("{0}", i);
                }
            }

            {
                CParent p = new CTest();
                p.Func();
                p.VFunc();
            }
        }