Skip to content

Instantly share code, notes, and snippets.

@Fhernd
Created April 27, 2014 22:14
Show Gist options
  • Save Fhernd/11356929 to your computer and use it in GitHub Desktop.
Save Fhernd/11356929 to your computer and use it in GitHub Desktop.
Demostración del uso del modificador de acceso public en C#.
// ===++===
//
// 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