Am 19.09.2011 03:00, schrieb Stas Malyshev:
> The example without abstract works, but produces E_STRICT which is useless too
right - because the following code is totally valid and reasonable even if
"my_function" will later get a fourth param $d='default' and the strict warnings
here forcing you to disable E_STRICT with the negative impact losing usefull
strict-warinings or rewrite tons of code after changes in a extended class with
a
new optional param
someone who is using "my_b" needs not to know anything about "my_a" which
usually
is in a foreign file and often an external library
<?php
class my_a
{
public function my_function($a, $b, $c)
{
echo "$a, $b, $c";
}
}
class my_b extends my_a
{
public function my_function($a)
{
parent::my_function($a, 'internal default b', 'internal default c');
}
}
$instance = new my_b();
$instance->my_function('test');
?>
signature.asc
Description: OpenPGP digital signature
