Toggle navigation
Genres
Frontend (2)
JavaScript (6)
Database (2)
Linux Server (3)
Web Apps (4)
Misc (4)
Search
List
New Tutorials
Last Modified Tutorials
</>
Code examples
code
smiko
backend
php
oop
classes_objects
36visibility_propertyOverride.php
36visibility_propertyOverride.php
<?php class A { public $a_pub='Public svojstvo'; protected $a_prot='Protected svojstvo'; private $a_priv='Private svojstvo'; } class B extends A { //override public $a_pub='Public Overriden'; protected $a_prot='Protected Overriden'; private $a_priv='Private Overriden'; public function ispis_b() { echo $this->a_pub; echo $this->a_prot; echo $this->a_priv; } } //SUBCLASS $obj_b=new B; $obj_b->ispis_b(); //ispisuje: Public OverridenProtected OverridenPrivate Overriden var_dump($obj_b); ?>
Reload page
Preview
W3C validation
Edit Code