Attributes in Inheritance using abstract class

0

I'm wanting to use inheritance with parent class being abstract. The issue is that I'm using superscript toString () so that each impression of child classes can print their respective data. But when I use "this" inside the toString on the attributes it shows me that: String personas.Pessoa.nome. When I access, there will be a difference between Professor and another Official, such as Administrator.

package pessoas;

public abstract class Pessoa {

    protected String nome;
    protected String matricula;
    protected String cpf;

    @Override
    public abstract String toString();

    //getters e setters

}

package pessoas;

import rh.Funcionario;

public class Professor extends Pessoa implements Funcionario{

    @Override
    public String toString() {
        return this.nome + this.cpf + this.matricula;
    }

    @Override
    public Double salario() {
        // TODO Auto-generated method stub
        return null;
    }
}
    
asked by anonymous 22.09.2017 / 00:04

0 answers