Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            Point point;

            //point.x = 10;
            //point.y = 10;
            point = new Point();
            Console.WriteLine("x:" + point.x);
            Console.WriteLine("y:" + point.y);


            PointClass pointClassA = new PointClass(10, 100);
            PointClass pointClassB = pointClassA;

            pointClassB.x = 20;
            pointClassB.y = 200;
            Console.WriteLine("pointClassA:" + pointClassA.x + "/" + pointClassA.y);
            Console.WriteLine("pointClassB:" + pointClassB.x + "/" + pointClassB.y);

            PointStruct pointStructA = new PointStruct(10, 100);
            PointStruct pointStructB = pointStructA;

            pointStructB.x = 20;
            pointStructB.y = 200;
            Console.WriteLine("pointStructA:" + pointStructA.x + "/" + pointStructA.y);
            Console.WriteLine("pointStructB:" + pointStructB.x + "/" + pointStructB.y);
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            Point point; //== int x

            //point = new Point(); // x=0,y=0; new 키워드 쓰면 기본값으로 초기화해준다.
            point.x = 10;
            point.y = 10;


            Pointclass pointClassA = new Pointclass(10, 20);
            Pointclass pointClassB = pointClassA;

            pointClassB.x = 100;
            pointClassB.y = 200;

            Console.WriteLine("pointClassA : " + pointClassA.x + "," + pointClassA.y);
            Console.WriteLine("pointClassB : " + pointClassB.x + "," + pointClassB.y);


            PointStruct pointStructA = new PointStruct(10, 20);
            PointStruct pointStructB = pointStructA;

            pointStructB.x = 100;
            pointStructB.y = 200;

            Console.WriteLine("pointStructA : " + pointStructA.x + "," + pointStructA.y);
            Console.WriteLine("pointStructB : " + pointStructB.x + "," + pointStructB.y);
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
            Point point;

            point.x = 10;
            point.y = 10;
            Console.WriteLine("X: " + point.x);
            Console.WriteLine("Y: " + point.y);

            Pointclass pointclassA = new Pointclass(10, 20);
            Pointclass pointclassB = pointclassA;

            pointclassB.x = 100;
            pointclassB.y = 200;

            Console.WriteLine("pountClassA: " + pointclassA.x + ", " + pointclassA.y);
            Console.WriteLine("pountClassB: " + pointclassB.x + ", " + pointclassB.y);
            Console.WriteLine("");

            //구조체
            PointStruct pointStructA = new PointStruct(10, 20);
            PointStruct pointStructB = pointStructA;

            pointStructB.x = 100;
            pointStructB.y = 200;

            Console.WriteLine("pointStructA: " + pointStructA.x + ", " + pointStructA.y);
            Console.WriteLine("pointStructB: " + pointStructB.x + ", " + pointStructB.y);
        }
Ejemplo n.º 4
0
        static void Main(string[] args)
        {
            Point p = new Point();

            p.x = 10;
            p.y = 10;
            Console.WriteLine("point: " + p.x + " / " + p.y);

            PointClass pointClassA = new PointClass(10, 20);
            PointClass pointClassB = pointClassA;

            pointClassB.x = 100;
            pointClassB.y = 200;
            Console.WriteLine("pointClassA : " + pointClassA.x + " / " + pointClassA.y);
            Console.WriteLine("pointClassB : " + pointClassB.x + " / " + pointClassB.y);

            PointStruct pointStructA = new PointStruct(10, 20);
            PointStruct pointStructB = pointStructA;

            pointStructB.x = 100;
            pointStructB.y = 200;
            Console.WriteLine("pointStructA : " + pointStructA.x + " / " + pointStructA.y);
            Console.WriteLine("pointStructB : " + pointStructB.x + " / " + pointStructB.y);
        }