03/02_pokusB.php


  1  <html>
  2  <body>
  3  <?php
  4  
  5  class CA
  6  {
  7    private $x="?";
  8    public function CA($x)
  9    {
 10      $this->x=$x;
 11      echo "CA::CA($x)<br />\r\n";
 12    }
 13    public function __set($meno,$hodnota)
 14    {
 15      print("Nastavované: \$$this->x->$meno=$hodnota<br />\n");
 16  
 17    }
 18  }
 19  
 20  $A = new CA("A");
 21  $B = new CA("B");
 22  
 23  $A->p="Kuk";
 24  $B->p="Juj";
 25  
 26  echo "\$A->p=$A->p<br />\r\n";
 27  echo "\$B->p=$B->p<br />\r\n";
 28  
 29  ?>
 30  </body>
 31  </html>

« Spä¯