<?php
include("Overload.class.php");
class Example extends Overload
{
protected function foo()
{
return NULL;
}
protected function foo_S($string)
{
echo $string;
}
protected function foo_SI($string, $integer)
{
echo $string . " equals " . $integer . ".";
}
}
$o = new Example();
$o->foo(); // Will call foo()
$o->foo("Hello World!"); // Will call foo_S("Hello World!")
$o->foo("Pi", 3); // Will call foo_SI("Pi", 3)
$o->foo(3, "Pi"); // Will lead to an error because there is no function with foo_IS
$o->foo($o, 1); // Will lead to an error because there is no function with foo_OI
?>
|