-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathinit.php
More file actions
95 lines (61 loc) · 1.84 KB
/
init.php
File metadata and controls
95 lines (61 loc) · 1.84 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
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
<?php
require_once 'AnimalsClass.php';
require_once 'MammalsClass.php';
require_once 'DogClass.php';
try{
$aDog = new DogClass();
$aDog -> makeNoise();
$aDog -> sleep();
echo 'Köpekler '.$aDog->getFamily(). ' familyasındandır. '.$aDog->getFamily().' familyası '.$aDog->getReproduction().' ile ürer.<br>';
echo 'Benim adım: ',$aDog->getName();
var_dump($aDog);
}catch(Exception $e){
echo $e->getMessage();
}
die();
require_once 'AnimalsClass.php';
require_once 'MammalsClass.php';
$aMammal = new MammalsClass();
$aMammal -> makeNoise();
$aMammal -> sleep();
echo 'Memelilerin üreme yöntemi; '.$aMammal->getReproduction(). ' dur.';
var_dump($aMammal);
die();
require_once 'AnimalsClass.php';
try {
$anAnimal = new AnimalsClass('memeli');
$anAnimal -> makeNoise();
$anAnimal -> sleep();
var_dump($anAnimal);
} catch(Exception $e) {
echo $e -> getMessage();
}
die();
require_once 'NonMammalsClass.php';
require_once 'MammalsClass.php';
require_once 'DogClass.php';
require_once 'BirdClass.php';
$dog = new DogClass('Duman');
echo '<h3>Genel bilgi</h3>';
echo 'Köpek ', $dog -> getName(), ', ', 'bir ', $dog -> getFamily(), ' dir. ', $dog -> getFamily(), ' bir hayvan', ' sadece ', $dog -> getGiveBirth(), ' yapar.<br>';
echo '<h4>Davranışlar</h4>';
$dog -> sleep();
$dog -> makeNoise();
var_dump($dog);
echo '<hr>';
$bird = new BirdClass('tweety');
echo '<h3>Genel bilgi</h3>';
echo 'Kuş ', $bird -> getName(), ', ', 'bir ', $bird -> getFamily(), ' dir. ', $bird -> getFamily(), ' bir hayvan', ' sadece ', $bird -> getGiveBirth(), ' yapar.<br>';
echo '<h4>Davranışlar</h4>';
$bird -> sleep();
$bird -> makeNoise();
$bird -> fly();
var_dump($bird);
var_dump(get_class_methods($bird));
echo '<hr>';
try {
$anAnimal = new AnimalsClass('sürüngen');
} catch(Exception $e) {
echo '<h3>Hata</h3>';
echo $e -> getMessage();
}