p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   BOOK: Professional PHP 5 ISBN: 978-0-7645-7282-1 (http://p2p.wrox.com/forumdisplay.php?f=152)
-   -   About the musician exercise (http://p2p.wrox.com/showthread.php?t=33084)

mysticav September 2nd, 2005 03:09 PM

About the musician exercise
I was reading that the interface methods must mention explicitly the parameters like this:
public function addInstrument(Instrument $instrument);

but in the book they just put this:
    public function addInstrument();

I'm new to interfaces, and I know a little about basic OOP. So, I don't want to be confused at this stage.

PKHG June 27th, 2006 09:39 AM

Indeed, in the downloaded ch02 code are more errors of the same kind as well as another syntax-error

    public function assignToBand(Band $band) {
 //error! $this->$bandReference = $band;
      $this->bandReference = $band;

loremipsum3891 October 30th, 2009 06:36 AM

I'm working on that chapter after fixing those interfaces I got this in my browser:

Musician Jack Float

Catchable fatal error: Object of class Guitarist could not be converted to string in /var/www/php5_book/mycode/ch2/sampleCode.php on line 164

All times are GMT -4. The time now is 06:16 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.