Sample Code (PHP)
0.1 20120518
Main Page
Classes
Files
File List
File Members
animals.php
Go to the documentation of this file.
1
<?php
2
/***** Copyright 2012 Simon Dales
3
**
4
** This work may be distributed and/or modified under the
5
** conditions of the LaTeX Project Public License, either version 1.3
6
** of this license or (at your option) any later version.
7
** The latest version of this license is in
8
** http://www.latex-project.org/lppl.txt
9
**
10
** This work has the LPPL maintenance status `maintained'.
11
**
12
** The Current Maintainer of this work is Simon Dales.
13
*/
14
24
25
function
TIO_write
($Str)
26
{
27
printf(
'%s'
,$Str);
28
}
29
31
function
TIO_writeln
($Str)
32
{
33
printf(
"%s\n"
,$Str);
34
}
35
37
class
Animal
{
38
function
Animal
(){
39
$this->
setKind
(
'animal'
);
40
}
41
function
setKind
($Kind){
42
$this->kind = $Kind;
43
}
44
function
call
(){
45
$speigel = $this->speigel;
46
if
(isset($speigel))
47
$speigel =
' says "'
. $speigel .
'"'
;
48
else
49
$speigel =
' <undefined call>'
;
50
51
TIO_writeln
($this->kind . $speigel);
52
}
53
54
};
55
57
class
Bird
extends
Animal
{
58
function
Bird
(){
59
$this->
setKind
(
'bird'
);
60
}
61
};
62
64
class
Pigeon
extends
Bird
{
65
function
Pigeon
(){
66
$this->
setKind
(
'pigeon'
);
67
$this->speigel =
'oh my poor toe Betty'
;
68
}
69
};
70
72
class
RedKite
extends
Bird
{
73
function
RedKite
(){
74
$this->
setKind
(
'red kite'
);
75
$this->speigel =
'weee-ooo ee oo ee oo ee oo'
;
76
}
77
};
78
80
class
Mammal
extends
Animal
{
81
};
82
84
class
Cat
extends
Mammal
{
85
function
Cat
(){
86
$this->
setKind
(
'cat'
);
87
$this->speigel =
'meow'
;
88
}
89
};
90
92
class
Dog
extends
Mammal
{
93
function
Dog
(){
94
$this->
setKind
(
'dog'
);
95
$this->speigel =
'woof'
;
96
}
97
};
98
99
//eof
100
?>
Generated on Thu Feb 7 2013 10:03:31 for Sample Code (PHP) by
1.8.2