-
Notifications
You must be signed in to change notification settings - Fork 2
/
Comprador.java
47 lines (38 loc) · 1015 Bytes
/
Comprador.java
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
public class Comprador extends Utilizador{
// Construtores
public Comprador () {
super("", "", false);
}
public Comprador (String username, String password, boolean logged) {
super(username, password, logged);
}
public Comprador (Comprador a) {
super(a);
}
// clone
public Comprador clone () {
return new Comprador(this);
}
//Equals
@Override
public boolean equals(Object o){
if(this == o)
return true;
if ((o==null) || (this.getClass() != o.getClass()))
return false;
Comprador m = (Comprador) o;
return (super.equals(m));
}
//toString
@Override
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append("----|COMPRADOR|----\n");
sb.append(super.toString()).append("\n");
return sb.toString();
}
@Override
public int hashCode(){
return this.getUsername().hashCode();
}
}