Guest User

Untitled

a guest
Aug 16th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.26 KB | None | 0 0
  1. <?php
  2.  
  3. class A {
  4. private $val = 'a';
  5.  
  6. public function test()
  7. {
  8. return $this->val;
  9. }
  10. }
  11.  
  12. class B extends A {
  13. public $val = 'b';
  14.  
  15. public function test()
  16. {
  17. return A::test();
  18. }
  19. }
  20.  
  21. $b = new B();
  22. echo $b->test(); // output 'a'
Add Comment
Please, Sign In to add comment