ID: 9618
Updated by: stas
Reported By: [EMAIL PROTECTED]
Old-Status: Open
Status: Closed
Bug Type: Scripting Engine problem
Assigned To: 
Comments:

PHP is not C++, you cannot have two functions with same
names and different parameters.

Previous Comments:
---------------------------------------------------------------------------

[2001-03-08 06:51:35] [EMAIL PROTECTED]
Hi,

PHP acts strangely when calling a parent class constructor from an extended class. 
PHP4 seems to call the constructor without arguments instead of the one with the right 
number of arguments.

Regards,
Ari Nykänen

// -------- clip clip clip ----------------

<script language="php">
        class Huikkari {
                var $huikkasana="initial";
                function Huikkari($huikkasana) {
                        $this->huikkasana=$huikkasana;
                }
                function Huikkari() {
                        $this->huikkasana="default";
                }
                function huikkaa () {
                        echo ($this->huikkasana."n");
                        return true;
                }
        }

        class HelloHuikkari extends Huikkari {
                function helloHuikkari () {
// *** possible problem here *** the following line seems
// to call the Huikkari constructor with no arguments
                        $this->Huikkari('Hello World');
                }
        }

        $helloHuikkari = new HelloHuikkari();
// I think the following line should
// output 'Hello World' instead of 'defaultt'
        $helloHuikkari->huikkaa();

</script>


---------------------------------------------------------------------------



ATTENTION! Do NOT reply to this email!
To reply, use the web interface found at http://bugs.php.net/?id=9618&edit=2


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to