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
03basics_extends.php
03basics_extends.php
<?php class MojaKlasa { public $var_a='Var a'; public function metoda_a() { return "Tekst iz metode a"; } } class DodanaKlasa extends MojaKlasa { public $var_b='Var b'; public function metoda_b() { return "Tekst iz metode b"; } } //defininranje objekta $obj=new DodanaKlasa(); //properties echo $obj->var_b; //self property echo $obj->var_a; //parent property //methods echo $obj->metoda_b(); //self method echo $obj->metoda_a(); //parent method // echo "<br/><br/><br/><hr><br/>"; var_dump($obj); ?>
Reload page
Preview
W3C validation
Edit Code