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
68interface_extends.php
68interface_extends.php
<?php /** *Primjer pokazuje da klasa moze implementirati vise *interface-a */ interface X { const PII=3.14; public function metodaX(); } interface Y extends X { public function metodaY($p1,$p2); } class A implements Y { //mora se definirati i metodaX i metodaY jer u protivnom //javlja gresku public function metodaX(){ echo 'Broj PI iznosi '.X::PII; } public function metodaY($p1,$p2){ echo "<br/>{$p1} {$p2}"; } } $obj=new A; $obj->metodaX(); $obj->metodaY('pas','macka'); ?>
Reload page
Preview
W3C validation
Edit Code