class Empleado
{
private int edad;
private string nombre;
public void SetEdad(int edad)
{
if (edad < 0 || edad > 99) throw new ArgumentOutOfRangeException();
this.edad = edad;
}
public void SetNombre(string nombre) => this.nombre = nombre;
public Empleado(int edad, string nombre)
{
SetEdad(edad);
SetNombre(nombre);
}
}
public class empleado
{
private int edad;
public int Edad
{
get {return edad;}
set
{
if(value<0 || value>99)
throw new ArgumentOutOfRangeException($"{nameof(value)} debe estar entre 0 y 99.");
edad=value;
}
}
}