2008-01-30 22:25:57 +08:00
|
|
|
--TEST--
|
|
|
|
Redeclare inherited protected property as public.
|
|
|
|
--FILE--
|
|
|
|
<?php
|
|
|
|
class A
|
|
|
|
{
|
|
|
|
protected $p = "A::p";
|
|
|
|
function showA()
|
|
|
|
{
|
|
|
|
echo $this->p . "\n";
|
|
|
|
}
|
|
|
|
}
|
2018-09-17 01:16:42 +08:00
|
|
|
|
2008-01-30 22:25:57 +08:00
|
|
|
class B extends A
|
|
|
|
{
|
|
|
|
public $p = "B::p";
|
|
|
|
function showB()
|
|
|
|
{
|
|
|
|
echo $this->p . "\n";
|
|
|
|
}
|
|
|
|
}
|
2018-09-17 01:16:42 +08:00
|
|
|
|
|
|
|
|
2008-01-30 22:25:57 +08:00
|
|
|
$a = new A;
|
|
|
|
$a->showA();
|
2018-09-17 01:16:42 +08:00
|
|
|
|
2008-01-30 22:25:57 +08:00
|
|
|
$b = new B;
|
|
|
|
$b->showA();
|
|
|
|
$b->showB();
|
|
|
|
?>
|
2018-02-19 16:59:41 +08:00
|
|
|
--EXPECT--
|
2008-01-30 22:25:57 +08:00
|
|
|
A::p
|
|
|
|
B::p
|
|
|
|
B::p
|