Re: Inheritance/compatibility behavior

From: Date: Tue, 29 Apr 2008 15:43:22 +0000
Subject: Re: Inheritance/compatibility behavior
References: 1  Groups: php.internals 
Request: Send a blank email to internals+get-37299@lists.php.net to get a copy of this message
On Tuesday 29 April 2008 15:34:07 Sam Barrow wrote: > This will not work, I get an error that the two must be compatible. > Wouldn't it be a good idea to allow any type hint for a parameter that > does not specify a type hint? That would be a bad idea, because it violates a (in my opinion, the) core principle of OO: If B inherits from A, anything I can do with A (i.e. pass an int to the method go) I can do with B. http://en.wikipedia.org/wiki/Liskov_substitution_principle Regards, Stefan P.S. Sorry if this pops up twice, used the wrong from: address at first ...

« previous php.internals (#37299) next »