#22253 [Opn->Bgs]: method becomes constructor in subclass
| From: | sniper@php.net | Date: | Sun, 23 Feb 2003 07:20:06 +0000 |
| Subject: | #22253 [Opn->Bgs]: method becomes constructor in subclass | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-33968@lists.php.net to get a copy of this message | ||
ID: 22253
Updated by: sniper@php.net
Reported By: goba@php.net
-Status: Open
+Status: Bogus
Bug Type: Class/Object related
Operating System: win2k
PHP Version: 4.2.3
New Comment:
It's by design and even documented here:
http://www.php.net/manual/en/language.oop.constructor.php
Previous Comments:
------------------------------------------------------------------------
[2003-02-21 17:37:00] andrew at evilwalrus dot com
According to the comments on the OOP manual page, if a constructor is
not located in the base class, the function of the same name will be
located in subsequent classes, and loaded accordingly. Yes, this is by
design, but no, i personally don't like it... correct me if i'm wrong,
please.
~ Andrew Heebner
------------------------------------------------------------------------
[2003-02-17 11:38:10] goba@php.net
In this example, the printStr() method becomes the constructor of the
printStr class, while I think it should not be working this way... I
hope this is not by design ;)
class String
{
function printStr($string)
{
print $string;
}
}
class printStr extends String {}
$ps = new printStr("abc");
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=22253&edit=1