summaryrefslogtreecommitdiff
path: root/Master/texmf-dist/doc/support/lua2dox/examples/php/animals.php
blob: d7e092e68e485f9f5613846d7e581e37292cfbdc (plain)
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
<?php
/***** Copyright 2012 Simon Dales
**
** This work may be distributed and/or modified under the
** conditions of the LaTeX Project Public License, either version 1.3
** of this license or (at your option) any later version.
** The latest version of this license is in
**   http://www.latex-project.org/lppl.txt
**
** This work has the LPPL maintenance status `maintained'.
** 
** The Current Maintainer of this work is Simon Dales.
*/

/*!
	\file
	\brief test some classes
	
	Here we make some animals
	
	*/
	

//! \brief write to stdout
function TIO_write($Str)
{
	printf('%s',$Str);
}

//! \brief writeln to stdout
function TIO_writeln($Str)
{
	printf("%s\n",$Str);
}

//! \brief a base class
class Animal{
	function Animal(){ //! \brief constructor
		$this->setKind('animal');
		}
	function setKind($Kind){ //! \brief set kind of object
		$this->kind = $Kind;
		}
	function call(){ //! \brief say the call of this animal
		$speigel = $this->speigel;
		if (isset($speigel))
			$speigel = ' says "' . $speigel . '"';
		else
			$speigel = ' <undefined call>';
	
		TIO_writeln($this->kind . $speigel);
		}

};

//! \brief an abstract bird
class Bird extends Animal{
	function Bird(){ //! \brief constructor
		$this->setKind('bird');
		}
};

//! \brief a subclassed bird
class Pigeon extends Bird{
	function Pigeon(){ //! \brief constructor
		$this->setKind('pigeon');
		$this->speigel = 'oh my poor toe Betty';
		}
};

//! \brief another subclassed bird
class RedKite extends Bird{
	function RedKite(){ //! \brief constructor
		$this->setKind('red kite');
		$this->speigel = 'weee-ooo ee oo ee oo ee oo';
		}
};

//! \brief a base mammal
class Mammal extends Animal{
};

//! \brief a subclassed mammal
class Cat extends Mammal{
	function Cat(){ //! \brief constructor
		$this->setKind('cat');
		$this->speigel = 'meow';
		}
};

//! \brief another subclassed mammal
class Dog extends Mammal{
	function Dog(){ //! \brief constructor
		$this->setKind('dog');
		$this->speigel = 'woof';
		}
};

//eof
?>