Advertisement
Fhernd

Punto.cs

Jul 25th, 2014
705
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.60 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Articulos.Preguntas
  4. {
  5.     public struct Punto
  6.     {
  7.         public int x;
  8.         public int y;
  9.        
  10.         public Punto (int x, int y)
  11.         {
  12.             this.x = x;
  13.             this.y = y;
  14.         }
  15.     }
  16.    
  17.     public sealed class PuntoPrueba
  18.     {
  19.         public static void Main()
  20.         {
  21.             Punto a = new Punto (13, 13);
  22.             Punto b = a;
  23.            
  24.             a. x = 19;
  25.            
  26.             // Impresión de la ordenada 'x' de la variable `b`:
  27.             Console.WriteLine ( b.x);    // Salida: 13
  28.         }
  29.     }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement