-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPessoa.java
More file actions
50 lines (39 loc) · 1.24 KB
/
Pessoa.java
File metadata and controls
50 lines (39 loc) · 1.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// * Classe abstrata Pessoa - Demonstra:
// * 1. ABSTRAÇÃO: Representa o conceito genérico de uma pessoa no sistema
// * 2. ENCAPSULAMENTO: Atributos privados com getters/setters
// * 3. MÉTODOS ABSTRATOS: exibirInformacoes() para implementação obrigatória nas subclasses
// * 4. COMPOSIÇÃO DE COMPORTAMENTO: Método toString() fornece representação padrão
public abstract class Pessoa {
private String nome;
private String cpf;
private String telefone;
public Pessoa(String nome, String cpf, String telefone) {
this.nome = nome;
this.cpf = cpf;
this.telefone = telefone;
}
public String getNome() {
return nome;
}
public void setNome(String nome) {
this.nome = nome;
}
public String getCpf() {
return cpf;
}
public void setCpf(String cpf) {
this.cpf = cpf;
}
public String getTelefone() {
return telefone;
}
public void setTelefone(String telefone) {
this.telefone = telefone;
}
// Metodo abstrato para ser implementado nas subclasses
public abstract void exibirInformacoes();
@Override
public String toString() {
return nome + " | CPF: " + cpf + " | Tel: " + telefone;
}
}