The super()
function is for calling the parent constructor and checking for proper signatures.
public class Pessoa {
private String nome;
private String endereco;
private String telefone;
private String cpf;
private String telefoneCelular;
public Pessoa(String nome, String endereco, String telefone) {
this.nome = nome;
this.endereco = endereco;
this.telefone = telefone;
}
}
public class Aluno extends Pessoa {
public Aluno() {
super();
}
public Aluno(String curso, double[] notas, String nome, String endereco, String telefone) {
super(nome, endereco, telefone);
this.curso = curso;
this.notas = notas;
}
}
Although I know it works this way, I do not understand how signing verification is done when the scope variables are different.
public class Aluno extends Pessoa {
public Aluno() {
super();
}
public Aluno(String curso, double[] notas, String teste1, String teste2, String teste3) {
super(teste1, teste2, teste3);
this.curso = curso;
this.notas = notas;
}
}
The check would be in the order in which the variables are declared within the super function, since all are of the same type ( String
).