Ver Mensaje Individual
  #7 (permalink)  
Antiguo 29/10/2007, 15:19
Avatar de GatorV
GatorV
$this->role('moderador');
 
Fecha de Ingreso: mayo-2006
Ubicación: /home/ams/
Mensajes: 38.567
Antigüedad: 18 años, 9 meses
Puntos: 2135
Re: Ejemplo: carga centralizada de clases, uso semidescentralizado y singleton.

Cita:
Iniciado por oVuzZ Ver Mensaje
No crees ke en la clase Singleton deveria haver una 2 funciones para que funcione

Código PHP:
function setValor($str){
$this->valor $a
}

function 
getValor(){
return 
$this->valor

quedando la clase singleton asi?

Código PHP:
<?php
class Singleton {
    static private 
$instance;

    private function 
__construct() {}
    
    static function 
getInstance() {
        if (!isset(
self::$instance)) {
            
$c __CLASS__;
            
self::$instance = new $c;
        }
        return 
self::$instance;
    }    

        public function 
setValor($str){
           
$this->valor $a
        }

     public function 
getValor($str){
          return 
$this->valor
      }


}
?>
o me ekivoco corrigueme!!
Asi es faltaria solo agregar las funciones a la clase Singleton, no las puse porque creo que van de mas.

Saludos.