02/02.php


  1  <html>
  2  <body>
  3  <?php
  4  
  5  class CA
  6  {
  7    private $p;
  8    function CA($x)
  9    {
 10      echo "CA:CA($x)<br />\r\n";
 11      $this->NastavP($x);
 12    }
 13  
 14    function NastavP ($x)
 15    {
 16      if ($x<7) $this->p=7;
 17      else      $this->p=$x;
 18      echo "CA:NatavP($x) .. nastavené $this->p<br />\r\n";
 19    }
 20  
 21    function DajP ()
 22    {
 23      return $this->p;
 24    }
 25  }
 26  
 27  $A = new CA(55);
 28  $A->NastavP(3);
 29  $x=$A->DajP();
 30  echo "x = $x<br />\r\n";
 31  
 32  ?>
 33  </body>
 34  </html>

« Spä¯