Boxing2_b.Point.Change C# (CSharp) Method

Change() public method

public Change ( Int32 x, Int32 y ) : void
x System.Int32
y System.Int32
return void
        public void Change(Int32 x, Int32 y)
        {
            m_x = x; m_y = y;
        }
        public override String ToString()

Usage Example

Example #1
0
        public static void Main2()
        {
            Point p = new Point(1, 1);
            Console.WriteLine(p);

            p.Change(2, 2);
            Console.WriteLine(p);
            Object o = p;
            Console.WriteLine(o);
            ((Point)o).Change(3, 3);
            Console.WriteLine(o);
            // Boxes p, changes the boxed object and discards it 
            ((IChangeBoxedPoint)p).Change(4, 4);
            Console.WriteLine(p);
            // Changes the boxed object and shows it 
            ((IChangeBoxedPoint)o).Change(5, 5);
            Console.WriteLine(o);
        }