Ver Mensaje Individual
  #2 (permalink)  
Antiguo 11/02/2007, 00:42
Avatar de GatorV
GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 20 años, 5 meses
Puntos: 2135
Re: Constructores PHP

PHP no soporta como Java multiples constructores, lo que puedes hacer es algo asi:
Código PHP:
include_once( 'class.MySQL.php' );

class 
Usuario {
       private 
$mysql;
       private 
$user;
       private 
$pass;

       public function 
__construct() {
               
$this->mysql = new mysql();
               
$args = func_get_args();
               if( 
count( $args ) == 2 ) {
                     list( 
$user, $pass ) = each( $args );
                     
$this->user = $user;
                     
$this->pass = $pass;
               }
       }
}