Skip to content

Instantly share code, notes, and snippets.

@Fhernd
Created August 31, 2014 15:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Fhernd/74218e4f78e787307c86 to your computer and use it in GitHub Desktop.
Save Fhernd/74218e4f78e787307c86 to your computer and use it in GitHub Desktop.
La clase estudiante hereda de la clase `Persona` (https://gist.github.com/Fhernd/f636900a501289597616).
using System;
namespace Articulos.Preguntas.P0420
{
public class Estudiante : Persona
{
private String carnet;
public String Carnet
{
get
{
return carnet;
}
set
{
carnet = value;
}
}
// Constructor de `Estudiante` que invoca al constructor
// de la clase base `Persona`:
public Estudiante (string nombreEstudiante, string carnetEstudiante)
: base (nombreEstudiante)
{
carnet = carnetEstudiante;
}
public static void Main()
{
Estudiante estudiante = new Estudiante("John Learner", "201311620");
Console.WriteLine ("\nNombre del estudiante: {0}", estudiante.Nombre);
Console.WriteLine ("Carnet del estudiante: {0}\n", estudiante.Carnet);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment