duplicate function definitions are allowed in classes?

From: Date: Thu, 03 Aug 2000 08:57:57 +0000
Subject: duplicate function definitions are allowed in classes?
Groups: php.general 
Request: Send a blank email to php-general+get-9890@lists.php.net to get a copy of this message
I built and tested this simple class, I thought it would bomb, but it does not. Apparently, the parser just used the last definition found. Is this desired, documented, right? I thought I read somewhere that redfining a function was not allowed. See link below for output of function on my machine. http://webdev.oit.edu/~gearond/BadClass.php -------------------------------------- <?php class BadClass{ function DuplicatedFunction(){ return 1; } function DuplicatedFunction(){ return 2; } } $Test=new BadClass; print($Test->DuplicatedFunction()); phpinfo(); ?> -- ----------------------------------------------------------------- Time Spent With Your Dog(Kid) is Time Well Spent ----------------------------------------------------------------- Sincerely, Dennis Gearon

« previous php.general (#9890) next »