Classes

[email protected] ("Remco Brouwer")
Newsgroups php.doc.nl
Message-ID <[email protected]>
Hallo, ik heb een vraagje betreft classes.
Waarom geeft de output van deze code :
Hoi
Hoi

---------start---------
 class a {
  var $text1;
  var $text2;

  function SetText1($text) {
   $this->$text1 = $text;
  }

  function SetText2($text) {
   $this->$text2 = $text;
  }
 }

 class b extends a {
  function Test() {
   $this->SetText2("Hoi");
   echo $this->$text1 . "<br>";
   echo $this->$text2 . "<br>";
  }
 }

 $a = new b;
 $a->test();

---------end---------
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.