Created
April 27, 2014 22:14
-
-
Save Fhernd/11356929 to your computer and use it in GitHub Desktop.
Demostración del uso del modificador de acceso public en C#.
This file contains 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
// ===++=== | |
// | |
// OrtizOL | |
// | |
// ===--=== | |
/*============================================================ | |
// | |
// Clase: MOdificadorAccesopublic.cs | |
// | |
// Propósito: Demostrar el uso del modificador de acceso | |
// public. | |
// | |
============================================================*/ | |
using System; | |
class Punto | |
{ | |
public int x; | |
public int y; | |
} | |
class PruebaPublic | |
{ | |
public static void Main() | |
{ | |
Punto p = new Punto(); | |
// Acceso directo a los campos de instancia | |
p.x = 13; | |
p.y = 17; | |
// Impresión de los valores de los campos | |
Console.WriteLine ("P({0}, {1})", p.x, p.y); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment