Ver Mensaje Individual
  #16 (permalink)  
Antiguo 01/12/2008, 15:36
Avatar de Acron_0248
Acron_0248
 
Fecha de Ingreso: junio-2005
Ubicación: 127.0.0.1
Mensajes: 1.648
Antigüedad: 18 años, 10 meses
Puntos: 18
Respuesta: Mi primer objeto - critiquen!!!

Es simple, lo que te indica GatorV funcionaría así:
Código PHP:
class link2text extends link{    // clase Link a texto
  
private $anchor
    
  function 
__construct($url,$anchor){ 
   
parent::__construct($url); 
   
$this->anchor $anchor
  } 

 function 
dame_anchor($anchor){
   return 
$this->anchor;
 }
   
 function 
__toString(){ 
   return 
"<a href='$this->url'  $this->title >$this->anchor </a>";
 } 
}

$link = new link2text('http://www.ejemplo.com''Mi Ejemplo!');
$link->add_title('Esto es un ejemplo');
echo 
$link// mostrará: <a href='http://www.ejemplo.com' title='Esto es un ejemplo' >Mi Ejemplo!</a> 
__________________
Usuario Reigistrado de linux #399288