@@ 17-32 (lines=16) @@ | ||
14 | } |
|
15 | } |
|
16 | ||
17 | class SecondClass extends FirstClass { |
|
18 | ||
19 | private $_privateProperty; |
|
20 | ||
21 | protected function _protectedMethod() { |
|
22 | parent::_protectedMethod(); |
|
23 | echo "This is protected method of second class"; |
|
24 | $this->_privateProperty = parent::$_protectedProperty; |
|
25 | } |
|
26 | ||
27 | public function publicMethod() { |
|
28 | parent::publicMethod(); |
|
29 | echo "This is public method of second class"; |
|
30 | $this->_privateProperty = parent::$publicProperty; |
|
31 | } |
|
32 | } |
|
33 | ||
34 | class ThirdClass { |
|
35 | public function __construct(SecondClass $secondObject) { |
@@ 2-2 (lines=1) @@ | ||
1 | <?php |
|
2 | class FirstClass { protected $_protectedProperty; public $publicProperty; protected function _protectedMethod() { echo 'This is protected method of first class'; } public function publicMethod() { echo 'This is public method of first class'; } } class SecondClass extends FirstClass { private $_privateProperty; protected function _protectedMethod() { parent::_protectedMethod(); echo 'This is protected method of second class'; $this->_privateProperty = parent::$_protectedProperty; } public function publicMethod() { parent::publicMethod(); echo 'This is public method of second class'; $this->_privateProperty = parent::$publicProperty; } } class ThirdClass { public function __construct(SecondClass $spb91639) { $spb91639->publicMethod(); } } |