Re: PHP5: Class behavior: method overloading

From: Date: Sat, 28 Feb 2004 21:34:19 +0000
Subject: Re: PHP5: Class behavior: method overloading
References: 1 2 3 4  Groups: php.general php.internals 
Request: Send a blank email to internals+get-8252@lists.php.net to get a copy of this message
Hi Walter, On Thu, 26 Feb 2004 11:44:47 -0800, Walter A. Boring IV wrote: > ----well, if you are implementing something completely new in php5, > there there are no compatibility issues. I have many classes in my > projects in php4. I'm not sure of how many child constructors have > different parameters (my guess is not many), but enforcing strict > parameter count for childs classes would break compatibility. Which is > why I think that one should just use an interface to enforce this rule. > It seems like the right place for it. In the object oriented point of view, there are no differences between an interface and a class when you use something like this: ... } catch (MyException $e) { ... So, MyException is a "class" or an "interface" ? You can't tell. That's why this enforcement is applied over classes too. A class definition is still a commitment of "interfacing". When you extend the base class you are not supposed to break this commitment. If you allow this commitment break, it may lead to "buggy" code when you take a class by its superclass "interface". Best Regards, Cristiano Duarte

« previous php.internals (#8252) next »