-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathoop2.php
119 lines (119 loc) · 2.54 KB
/
oop2.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<?php
class person{
private $id;
private $name;
private $birthday;
private $address;
public function __construct(){
$this->id =null;
$this->name =null;
$this->birthday=null;
$this->address =null;
}
public function setId($id){
$this->id=$id;
}
public function getId(){
return $this->id;
}
public function setName($name){
$this->name=$name;
}
public function getName(){
return $this->name;
}
public function setBirthday($birthday){
$this->birthday=$birthday;
}
public function getBirthday(){
return $this->birthday;
}
public function setAddress($address){
$this->address=$address;
}
public function getAddress(){
return $this->address;
}
public function info($id_s=null){
echo "thong tin : " .$this->id ."ma".$id_s." la nguoi co ten " . $this->name . " co ngay sinh " . $this->birthday . " song o khu vuc " . $this->address;
}
public function rungning($run=""){
echo " chay ".$run;
}
public function sing(){
echo "khong biet hat ";
}
public function driving($driving=""){
echo "co bang lai ".$driving;
}
}
class student extends person{
private $student_id;
private $class;
private $subject;
private $time;
public function __construct(){
parent::__construct();
}
public function setStudent_id($student_id){
$this->student_id=$student_id;
}
public function getStudent_id(){
return $this->student_id;
}
public function setClass($class){
$this->class=$class;
}
public function getClass(){
return $this->class;
}
public function setSubject($subject){
$this->subject=$subject;
}
public function getSubject(){
return $this->subject;
}
public function setTime($time){
$this->time=$time;
}
public function getTime(){
return $this->time;
}
public function setPerson($id,$name,$birthday=null,$address=null){
$this->setId($id);
$this->setName($name);
$this->setBirthday($birthday);
$this->setAddress($address);
}
public function info_sv(){
echo "ma sinh vien : ".$this->student_id ."lop ".$this->class ;
}
public function studing(){
echo"mon hoc " .$this->subject;
}
public function pratical(){
echo " thoi gian thuc hanh ".$this->time;
}
public function sing(){
echo " hat hay ";
}
}
$A= new student();
$A->setPerson('1',"cuong","1-1-1996","cau giay");
$A->info();
$A->setStudent_id("10000");
$A->setClass("k59");
$A->setSubject(" lap trinh huong doi tuong ");
$A->setTime("7h->18h");
echo"<br/>";
$A->rungning("nhanh");
echo"<br/>";
$A->driving("o to ");
echo "<br/>";
$A->info_sv();
echo"<br/>";
$A->studing();
echo "<br/>";
$A->pratical();
echo "<br/>";
$A->sing();