using System;
public class Empleado
{
string primerNombre;
public string PrimerNombre
{
get
{
return primerNombre;
}
set
{
primerNombre = value;
}
}
string apellido;
public string Apellido
{
get
{
return apellido;
}
set
{
apellido = value;
}
}
int edad;
public int Edad
{
get
{
return edad;
}
set
{
edad = value;
}
}
int idEmpleado;
public int IdEmpleado
{
get
{
return idEmpleado;
}
set
{
idEmpleado = value;
}
}
// Sobreescritura del método ToString
public override string ToString()
{
return String.Format("Nombre: {0}, Apellido: {1}, y Edad: {2}.", primerNombre, apellido, edad);
}
}
public class EmpleadoPrueba
{
public static void Main()
{
Empleado empleado = new Empleado();
empleado.PrimerNombre = "Juan";
empleado.Apellido = "Ortiz";
empleado.Edad = 40;
Console.WriteLine (empleado.ToString());
}
}
dXNpbmcgU3lzdGVtOwoKcHVibGljIGNsYXNzIEVtcGxlYWRvCnsKICAgIHN0cmluZyBwcmltZXJOb21icmU7CiAgICBwdWJsaWMgc3RyaW5nIFByaW1lck5vbWJyZQogICAgewogICAgICAgIGdldAogICAgICAgIHsKICAgICAgICAgICAgcmV0dXJuIHByaW1lck5vbWJyZTsKICAgICAgICB9CiAgICAgICAgc2V0CiAgICAgICAgewogICAgICAgICAgICBwcmltZXJOb21icmUgPSB2YWx1ZTsKICAgICAgICB9CiAgICB9CiAgICAKICAgIHN0cmluZyBhcGVsbGlkbzsKICAgIHB1YmxpYyBzdHJpbmcgQXBlbGxpZG8KICAgIHsKICAgICAgICBnZXQKICAgICAgICB7CiAgICAgICAgICAgIHJldHVybiBhcGVsbGlkbzsKICAgICAgICB9CiAgICAgICAgc2V0CiAgICAgICAgewogICAgICAgICAgICBhcGVsbGlkbyA9IHZhbHVlOwogICAgICAgIH0KICAgIH0KICAgIAogICAgaW50IGVkYWQ7CiAgICBwdWJsaWMgaW50IEVkYWQKICAgIHsKICAgICAgICBnZXQKICAgICAgICB7CiAgICAgICAgICAgIHJldHVybiBlZGFkOwogICAgICAgIH0KICAgICAgICBzZXQKICAgICAgICB7CiAgICAgICAgICAgIGVkYWQgPSB2YWx1ZTsKICAgICAgICB9CiAgICB9CiAgICAKICAgIGludCBpZEVtcGxlYWRvOwogICAgcHVibGljIGludCBJZEVtcGxlYWRvCiAgICB7CiAgICAgICAgZ2V0CiAgICAgICAgewogICAgICAgICAgICByZXR1cm4gaWRFbXBsZWFkbzsKICAgICAgICB9CiAgICAgICAgc2V0CiAgICAgICAgewogICAgICAgICAgICBpZEVtcGxlYWRvID0gdmFsdWU7CiAgICAgICAgfQogICAgfQogICAgCiAgICAvLyBTb2JyZWVzY3JpdHVyYSBkZWwgbcOpdG9kbyBUb1N0cmluZwogICAgcHVibGljIG92ZXJyaWRlIHN0cmluZyBUb1N0cmluZygpCiAgICB7CiAgICAgICAgcmV0dXJuIFN0cmluZy5Gb3JtYXQoIk5vbWJyZTogezB9LCBBcGVsbGlkbzogezF9LCB5IEVkYWQ6IHsyfS4iLCBwcmltZXJOb21icmUsIGFwZWxsaWRvLCBlZGFkKTsKICAgIH0KfQoKcHVibGljIGNsYXNzIEVtcGxlYWRvUHJ1ZWJhCnsKCXB1YmxpYyBzdGF0aWMgdm9pZCBNYWluKCkKCXsKCQlFbXBsZWFkbyBlbXBsZWFkbyA9IG5ldyBFbXBsZWFkbygpOwoJCQoJCWVtcGxlYWRvLlByaW1lck5vbWJyZSA9ICJKdWFuIjsKCQllbXBsZWFkby5BcGVsbGlkbyA9ICJPcnRpeiI7CgkJZW1wbGVhZG8uRWRhZCA9IDQwOwoJCQoJCUNvbnNvbGUuV3JpdGVMaW5lIChlbXBsZWFkby5Ub1N0cmluZygpKTsKCX0KfQ==