#22253 [Com]: method becomes constructor in subclass

From: Date: Fri, 21 Feb 2003 23:37:00 +0000
Subject: #22253 [Com]: method becomes constructor in subclass
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-33886@lists.php.net to get a copy of this message
ID: 22253 Comment by: andrew at evilwalrus dot com Reported By: goba@php.net Status: Open Bug Type: Class/Object related Operating System: win2k PHP Version: 4.2.3 New Comment: 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 Previous Comments: ------------------------------------------------------------------------ [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

« previous php.bugs (#33886) next »