Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
BOOK: Professional PHP 5 ISBN: 978-0-7645-7282-1
This is the forum to discuss the Wrox book Professional PHP5 by Ed Lecky-Thompson, Heow Eide-Goodman, Steven D. Nowicki, Alec Cove; ISBN: 9780764572821
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional PHP 5 ISBN: 978-0-7645-7282-1 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Display Modes
  #1 (permalink)  
Old February 8th, 2005, 08:11 AM
Registered User
 
Join Date: Feb 2005
Location: , , .
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to Norm 2782
Default [CH04] Interfaces

I just got to chapter 4 and got to the abstract_widget.php file.
It returned the following error:

Fatal error: Declaration of Widget::update() must be compatible with that of Observer::update() in C:\server\www\prophp\ch04\abstract_widget.php on line 6

I solved it by replacing the interface used in the example by the following one:

Code:
interface Observer {
    public function update(Observable $observable);
}
Is this 'legit' user of interfaces? Or is this a dirty solution to a (maybe very simple) problem?

Norm 2782, why are you here?
- Normality
  #2 (permalink)  
Old May 30th, 2005, 02:04 AM
Registered User
 
Join Date: May 2005
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to tnlinh
Default

I encountered the same problem and did exactly the same.

  #3 (permalink)  
Old June 15th, 2005, 09:13 PM
Registered User
 
Join Date: Jun 2005
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Yep, another one. Good one Norm2782.
I still don't see the benefit of this example or pattern for a web application. Anyone?

Nice Widgets, but that's about it.

As stated on p. 85, a redraw is not an option unless you reload the page.... so why putting Observers on data?
  #4 (permalink)  
Old June 16th, 2005, 05:56 AM
Registered User
 
Join Date: Jun 2005
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

can someone please clarify whether or not the previous example is a valid use for interfaces or not?

I had the same problem in chapter two!!

Code:
interface Musician {
     public function addInstrument();
     public function getInstruments();

     public function assignToBand();
     public function getMusicianType();
  }
Gave me this error
Fatal error: Declaration of Guitarist::addInstrument() must be compatible with that of Musician::addInstrument()

Code:
interface Musician {
     public function addInstrument(Instrument $instument);
     public function getInstruments();

     public function assignToBand(Band $band);
     public function getMusicianType();
  }
Seems to work

Is this correct ??

Thank

Sam

 


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
returning interfaces mike72 BOOK: ASP.NET 2.0 Website Programming Problem Design Solution ISBN: 978-0-7645-8464-0 0 April 17th, 2008 06:53 AM
interfaces malli_kv2 Java Basics 1 April 23rd, 2007 06:21 AM
Ch04 TIO Pg 111 Error lollivier BOOK: Beginning ASP.NET 2.0 BOOK VB ISBN: 978-0-7645-8850-1; C# ISBN: 978-0-470-04258-8 4 February 14th, 2006 11:31 AM
Polymorphism with Interfaces digby_dog VB.NET 2002/2003 Basics 2 May 11th, 2005 01:50 PM



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


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