Advertisement
Fhernd

Empleado.cs

Aug 31st, 2014
2,475
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.24 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Articulos.Preguntas.P0420
  4. {
  5.     public class Empleado : Persona
  6.     {
  7.         private String seguridadSocial;
  8.        
  9.         public String SeguridadSocial
  10.         {
  11.             get
  12.             {
  13.                 return seguridadSocial;
  14.             }
  15.             set
  16.             {
  17.                 seguridadSocial = value;
  18.             }
  19.         }
  20.        
  21.         // Constructor de `Empleado` que invoca al constructor
  22.         // de la clase base `Persona`:
  23.         public Empleado (string nombreEmpleado, string seguridadSocialEmpleado)
  24.             : base (CambiarMayusculas(nombreEmpleado))
  25.         {
  26.             seguridadSocial = seguridadSocialEmpleado;
  27.         }
  28.        
  29.         // Método que pasa a mayúsculas el nombre del empleado:
  30.         private static String CambiarMayusculas(string nombre)
  31.         {
  32.             return nombre.ToUpper();
  33.         }
  34.        
  35.         public static void Main()
  36.         {
  37.             Empleado empleado = new Empleado("John Worker", "201311620");
  38.            
  39.             Console.WriteLine ("\nNombre del empleado: {0}", empleado.Nombre);
  40.             Console.WriteLine ("Seguridad social del empleado: {0}\n", empleado.SeguridadSocial);
  41.         }
  42.     }
  43. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement