<!doctype html>

<?php 
function __autoload($className)
{
    require_once 'classes/' . $className . '.php';
}
// ANIMAL CLASS
$rat = new Animal('Lou', 'male', 100);
$kat = new Animal('Dik', 'female', 100);
$koe = new Animal('Mia', 'female', 80);
$kat->changeHealth(-10);
$koe->changeHealth(+5);
// LION CLASS
$simba = new lion('Simba', 'male', 100, 'Congo lion');
$scar = new lion('Scar', 'female', 100, 'Kenia lion');
// ZEBRA CLASS
$zeke = new zebra('Zeke', 'male', 120, 'Quagga');
$zana = new zebra('Zana', 'female', 100, 'Selous');
?>

<html>
<head>
<meta charset="utf-8">
<title>Naamloos document</title>
</head>

<body>

<h1>Opdracht classes extends</h1>
Exemple #2
0
    }
    class cat extends animal
    {
        function identify($type)
        {
            return parent::identify($type);
        }
    }
    class lion extends cat
    {
        function identify()
        {
            return parent::identify('lion');
        }
    }
    $p = new lion();
    echo "verifying passing arg to parent works, eg: parent::method(\$arg)<br>\n";
    echo "Result: " . ($p->identify() == "I am a lion." ? 'pass' : 'fail') . "<br><br>\n\n";
}
function test8()
{
    class road
    {
        var $type;
        var $lanes = 2;
        function __construct($rtype)
        {
            $this->type = $rtype;
        }
        function identify()
        {