I'm trying to make this class called 'Medico' that translates to Doctor, but in "this" it appears the error
Constructor 'Medico.Medico(string, string, int, string, string) cannot call itself.
I wanted to make a doctor class to add data in it, to a list view.
public class Medico
{
public string Nome { get; set; }
public string Especialidade { get; set; }
private int _NIF;
private DateTime _inicio;
private DateTime _fim;
public int NIF
{
get { return _NIF; }
set
{
_NIF = value;
if (_NIF < 99999999)
{
_NIF = 0;
}
}
}
public DateTime Inicio
{
get { return _inicio; }
set
{
_inicio = value;
}
}
public DateTime Fim
{
get { return _fim; }
set
{
_fim = value;
}
}
public Medico(string nome, string especialidade, int _NIF, DateTime _inicio, DateTime _fim)
{
Nome = nome;
Especialidade = especialidade;
NIF = _NIF;
Inicio = _inicio;
Fim = _fim;
}
public Medico(string nome, string especialidade, int _NIF, string _inicio, string _fim)
: this(nome, especialidade, _NIF, _inicio, _fim) {
}
public override string ToString()
{
return Inicio.ToString() + Fim.ToString();
}
}