PHP5: Class behavior: method overloading
| From: | Vivian Steller | Date: | Thu, 26 Feb 2004 18:47:25 +0000 |
| Subject: | PHP5: Class behavior: method overloading | ||
| Groups: | php.internals | ||
| Request: | Send a blank email to internals+get-8176@lists.php.net to get a copy of this message | ||
Hello,
in the latest snapshot i found some very important differences to the php5
beta 4 version concerning the behavior of inherited classes. please look at
the following example:
<pre>
<?php
class MyClass extends MyParent{
function test($arg) {
}
}
class MyParent {
function test($arg1, $arg2) {
}
}
$obj = new MyClass();
?>
</pre>
the output is:
Fatal error: Declaration of MyClass::test() must be compatible with that of
MyParent::test() in ... on line 3
I think that this is a nice feature in the face of "compatibility", but may
cause in a complete restructure of existing class trees. The consequence is
a bad :( backward compatibility!! Personally I think it would be a good
solution to set an option in the configuration or something like this.
other oppinions would be appreciated.
thanks,
vivi