note 91265 added to language.oop5.interfaces

From: Date: Tue, 02 Jun 2009 21:47:36 +0000
Subject: note 91265 added to language.oop5.interfaces
Groups: php.notes 
Request: Send a blank email to php-notes+get-156303@lists.php.net to get a copy of this message
This may help understand EX.2. Below are modifiers and additions to the code. Refer to EX.2 to make a complete code block(this saves comment space!). I found the function definition baz(Baz $baz) baffling. Lucky was able to sus it out fast. Seems method baz requires just one arg and that must be an instance of the class Baz. Here is a way to know how to deal with that sort of arg... <?php # modify iface b...adding $num to get better understanding interface b extends a { public function baz(Baz $baz,$num); } # mod claas c class c implements b { public function foo() { echo'foo from class c'; } public function baz(Baz $baz,$num) { var_dump ($baz);# object(Baz)#2 (1) { ["bb"]=> string(3) "hot" } echo '<br>'; echo $baz->bb." $num";echo '<br>';# hot 6 } } # add a class Baz... class Baz { public $bb='hot'; function ebaz(){ echo'this is BAZ'; } } # set instance of Baz and get some output... $bazI=new Baz; baz::ebaz();echo '<br>';# this is BAZ c::baz($bazI,6); ?> ---- Server IP: 69.147.83.197 Probable Submitter: 24.68.193.59 ---- Manual Page -- http://www.php.net/manual/en/language.oop5.interfaces.php Edit -- https://master.php.net/note/edit/91265 Del: integrated -- https://master.php.net/note/delete/91265/integrated Del: useless -- https://master.php.net/note/delete/91265/useless Del: bad code -- https://master.php.net/note/delete/91265/bad+code Del: spam -- https://master.php.net/note/delete/91265/spam Del: non-english -- https://master.php.net/note/delete/91265/non-english Del: in docs -- https://master.php.net/note/delete/91265/in+docs Del: other reasons-- https://master.php.net/note/delete/91265 Reject -- https://master.php.net/note/reject/91265 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#156303) next »