Guest User

Untitled

a guest
Jul 29th, 2015
212
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.40 KB | None | 0 0
  1. <?php
  2.  
  3. class ParentClass {
  4.  
  5.     protected $foo = "bar";
  6.  
  7.     public function __construct()
  8.     {
  9.         $this->foo = "baz";
  10.     }
  11. }
  12.  
  13.  
  14. class Child extends ParentClass {
  15.  
  16.     public function __construct()
  17.     {
  18.         //
  19.     }
  20.  
  21.     public function getFoo()
  22.     {
  23.         return $this->foo;
  24.     }
  25. }
  26.  
  27.  
  28. $child = new Child;
  29.  
  30. // co bude zobrazeno na vypisu?
  31. echo $child->getFoo();
Advertisement
Add Comment
Please, Sign In to add comment