Re: php5 interfaces...

From: Date: Tue, 15 Jul 2003 21:53:02 +0000
Subject: Re: php5 interfaces...
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-3426@lists.php.net to get a copy of this message
Zitat von Marcus BXrger <marcus.boerger@t-online.de>: > Hello Tony, > > Friday, July 11, 2003, 9:39:55 PM, you wrote: > > TB> In PHP5 I noticed this behaviou with interfaces. If I have an > interface > TB> with a method that takes no paramaters, an implementing class for > that > TB> interfaces can have the same method take parameters...is that right? > TB> For example: > > TB> interface foo { > TB> public function myFunction(); > TB> } > > TB> class foobar implements foo { > TB> public function myFunction($someText) > TB> { > TB> echo $someText; > TB> } > TB> } > > TB> $myObj = new foobar(); > $myObj->>myFunction('Testing, 1, 2, 3'); > > TB> This code works. To me it should flag an error or, at least a > warning, > TB> no? I can see the flexibility of allowing this as it provides a > kind-of > TB> form of overloading but I want to make sure this behaves as intended > TB> before I make use of this feature/bug. > > TB> --Tony > > > > PHP is a wek typed language....i see your point but we are not strict > typed. What does this have to do with typed languages? Interfaces are not types of method implementations or some such. There's also a warning if you call a function/method with too few or too much arguments, that seems much more similar to this case for me. Jan. -- http://www.horde.org - The Horde Project http://www.ammma.de - discover your knowledge http://www.tip4all.de - Deine private Tippgemeinschaft

« previous php.internals (#3426) next »