-
Notifications
You must be signed in to change notification settings - Fork 0
/
person.php
50 lines (46 loc) · 934 Bytes
/
person.php
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
<?php
abstract class person {
//atributes
protected $name;
protected $age;
protected $sex;
protected $experience;
//methods
protected function gainExp($n) {
$this->experience += $n;
}
public function __construct($name, $age, $sex) {
$this->name = $name;
$this->age = $age;
$this->sex = $sex;
$this->experience = 0;
}
public function getName() {
return $this->name;
}
public function setName($name) {
$this->name = $name;
return $this;
}
public function getAge() {
return $this->age;
}
public function setAge($age) {
$this->age = $age;
return $this;
}
public function getSex() {
return $this->sex;
}
public function setSex($sex) {
$this->sex = $sex;
return $this;
}
public function getExperience() {
return $this->experience;
}
public function setExperience($experience) {
$this->experience = $experience;
return $this;
}
}