[ create a new paste ] login | about

Link: http://codepad.org/rlSWx7SQ    [ raw code | output | fork ]

PHP, pasted on Feb 24:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php error_reporting(-1);
class Foo
{
    private $bar = "baz";
    public function getBar1()
    {
        return $this->bar;
    }
}

class Bar extends Foo
{
    public function getBar2()
    {
        return $this->bar;
    }
}

$o = new Bar;
echo $o->getBar1();      //baz
echo $o->getBar2();      //baz


Output:
1
2
baz
Notice: Undefined property:  Bar::$bar in /t.php on line 15


Create a new paste based on this one


Comments: