OEF06.java
1 |
|
2 |
|
3 |
Licensed under the Apache License, Version 2.0 (the "License"); |
4 |
you may not use this file except in compliance with the License. |
5 |
You may obtain a copy of the License at |
6 |
|
7 |
https://www.apache.org/licenses/LICENSE-2.0 |
8 |
|
9 |
Unless required by applicable law or agreed to in writing, software |
10 |
distributed under the License is distributed on an "AS IS" BASIS, |
11 |
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 |
See the License for the specific language governing permissions and |
13 |
limitations under the License.*/ |
14 |
import java.util.*; |
15 |
public class Person |
16 |
{ |
17 |
Person(){} |
18 |
Person(String voornaam, String naam, char geslacht) |
19 |
{ |
20 |
setVoornaam(voornaam); |
21 |
setNaam(naam); |
22 |
setGeslacht(geslacht); |
23 |
} |
24 |
|
25 |
public boolean equals(Person p) //OEF06.2 |
26 |
{ |
27 |
return (m_voornaam == p.voornaam() && |
28 |
m_naam == p.naam() && |
29 |
m_geslacht == p.geslacht()); |
30 |
//Het verschil met een simpele "==" tussen 2 objecten, is dat hier wordt gekeken of de waarden overeenstemmen. Bij een "==" tussen objecten moeten beide objecten gelijk zijn. |
31 |
} |
32 |
|
33 |
public String voornaam() |
34 |
return m_voornaam; |
35 |
public void setVoornaam(String voornaam) |
36 |
m_voornaam = voornaam; |
37 |
|
38 |
public String naam() |
39 |
return m_naam; |
40 |
public void setNaam(String naam) |
41 |
m_naam = naam; |
42 |
|
43 |
public char geslacht() |
44 |
return m_geslacht; |
45 |
public void setGeslacht(String geslacht) |
46 |
m_geslacht = geslacht; |
47 |
|
48 |
private String m_voornaam; |
49 |
private String m_naam; |
50 |
private char m_geslacht; |
51 |
|
52 |
//OEF06.3 |
53 |
private Person partner; |
54 |
private Person mom; |
55 |
private Person dad; |
56 |
} |
57 |