Created
July 6, 2013 12:17
-
-
Save Fhernd/5939738 to your computer and use it in GitHub Desktop.
Clase cliente que demuestra cómo funcionan las referencias.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class PuntoPrueba | |
{ | |
static void Main() | |
{ | |
Punto punto1 = new Punto(); | |
punto1.X = 7; | |
Punto punto2 = punto1; // Copia la referencia punto1 | |
Console.WriteLine(punto1.X); // 7 | |
Console.WriteLine(punto2.X); // 7 | |
punto1.X = 9; // Cambia punto1.X | |
Console.WriteLine(punto1.X); // 9 | |
Console.WriteLine(punto2.X); // 9 | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment