If an abstract class can not be instantiated, creating a constructor method for this abstract class can be considered as good practice or not? If so, what is the reason for creating the implementation of this method?
Here is a snippet of code that illustrates my question:
public abstract class Funcionario {
private String nome;
private int numeroRegistro;
public Funcionario(int numeroRegistro) {
setNumeroRegistro(numeroRegistro);
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public int getNumeroRegistro() {
return numeroRegistro;
}
public void setNumeroRegistro(int numeroRegistro) {
this.numeroRegistro = numeroRegistro;
}
public abstract double obterSalarioBruto();
@Override
public String toString() {
return "Funcionario [getNome()=" + getNome() + ", getNumeroRegistro()=" + getNumeroRegistro() + "]";
}
}