Sto facendo alcuni test per provare le caratteristiche della programmazione a oggetti in php4 (perche non ho ancora trovato hosting che forniscano php5); ma al primo test mi si é presentata subito un anomalia, e non capisco proprio dove sbaglio.


Codice PHP:
<?php

class TextBox {
  var 
$body_text "Clsse1";
  
// Constructor function
  
function __construct($text_in) {
    
$this->body_text $text_in;
  }
  function 
display() {
    print(
"<TABLE BORDER=1><TR><TD>$this->body_text");
    print(
"</TD></TR></TABLE>");
  }
}


class 
TextBoxHeader extends TextBox
{
  var 
$header_text;

  
// CONSTRUCTOR
  
function __construct($header_text_in
                   
$body_text_in) {
    
$this->header_text $header_text_in;
    
$this->body_text $body_text_in;
  }

  
// MAIN DISPLAY FUNCTION
  
function display() {
    
$header_html 
      
$this->make_header($this->header_text);
    
$body_html $this->make_body($this->body_text);
    print(
"<TABLE BORDER=1><TR><TD>\n");
    print(
"$header_html\n");
    print(
"</TD></TR><TR><TD>\n");
    print(
"$body_html\n");
    print(
"</TD></TR></TABLE>\n");
  } 

  
// HELPER FUNCTIONS
  
function make_header ($text) {
    return(
$text);
  }
  function 
make_body ($text) {
    return(
$text);
  }
}

$test = new TextBoxHeader("Header Classe2" "Footer Classe2");
$test->display();

?>
Allora spiego il codice, dalla prima classe che col metodo display scrive Classe1, estendo una seconda classe che ridefinisce il metodo display, che scrive Header Classe2 e Footer Classe2 , poi istanzio un oggetto e chiamo il metodo display della seconda classe, ma mi scrive "classe1" che corrisponde al metodo display della prima.

Mi sono spiegato un po contorto ma spero si capisc?
chi mi sa spiegare dove sbaglio? grazie.