Beispiel #1
0
<?php

class first
{
    private function show()
    {
        echo "Call show()\n";
    }
    public function do_show()
    {
        $this->show();
    }
}
$t1 = new first();
$t1->do_show();
class second extends first
{
}
//$t2 = new second();
//$t2->do_show();
class third extends second
{
    private function show()
    {
        echo "Call show()\n";
    }
}
$t3 = new third();
$t3->do_show();
echo "Done\n";
Beispiel #2
0
 public static function do_show()
 {
     first::show();
 }
Beispiel #3
0
        $this->me();
        $a->me();
        $b->me();
        $b = new second();
        $this->me();
        $a->me();
        $b->me();
    }
}
class second
{
    function who()
    {
        global $a, $b;
        $this->me();
        $a->me();
        $b->me();
    }
    function me()
    {
        echo "second";
    }
}
$a = new first();
$b =& $a;
$a->who();
$b->who();
echo "\n";
?>
===DONE===
Beispiel #4
0
<?php

class first
{
    function show()
    {
        echo "Call to function first::show()\n";
    }
}
$t = new first();
$t->show();
class second extends first
{
    final function show()
    {
        echo "Call to function second::show()\n";
    }
}
$t2 = new second();
$t2->show();
echo "Done\n";
Beispiel #5
0
<?php

class first
{
    public $a = "Question: What is your name";
    public $b = "Answer: My name is shohan";
    public function tell()
    {
        echo $this->b;
    }
}
$o = new first();
echo $o->a . "<br>";
$o->tell();
Beispiel #6
0
    var $family;
    var $number = 100;
    function hi()
    {
        echo "hi";
    }
    function full_name()
    {
        $name = "n";
        $shem = "name: " . $name . " " . $this->family;
        return $shem;
    }
}
$var = new first();
$var->hi();
echo "<br>";
//$var->name = "natan";
$var->family = "shalva";
$var->full_name();
echo "<br>second: ";
$scoend = new first();
// $scoend->hi();
echo "<br>";
$scoend->name = "nevet";
$scoend->family = "shalva";
echo $scoend->full_name();
?>

  </body>
</html>