Re: [PHP] OOP, Classes, Sharing Code

2004-06-29 Thread rush
"Joel Kitching" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > What generic class name would be appropriate in this case? I just > can't see how I would link the two together. Also, they would have to > use fairly generic variables names if I were to do this. Like using > the vari

Re: [PHP] OOP, Classes, Sharing Code

2004-06-29 Thread Gabriel Birke
Hello! Another option would be to have a generic "List" class that displays items in a list. Both your Album and Photo class should implement a method like "getNextItem" or the PHP5-native iterator methods so the List class can iterate over a class assigned to it without knowing what it is.

Re: [PHP] OOP, Classes, Sharing Code

2004-06-28 Thread Red Wingate
Look correct from my point of view... class Portfolio { var $portfolioID ; var $albums = array () ; function Portfolio ( $newID ) { $this->portfolioID = $newID ; } function addAlbum ( $album ) { $this->albums[] = $album ; } function getAlbum () { return curren

Re: [PHP] OOP, Classes, Sharing Code

2004-06-28 Thread Torsten Roehr
"Joel Kitching" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Mon, 28 Jun 2004 13:41:19 -0500, Jay Blanchard > <[EMAIL PROTECTED]> wrote: > > If you are going to duplicate code why not just create a generic class > > with the code that would be duplicated and then extend the clas

Re: [PHP] OOP, Classes, Sharing Code

2004-06-28 Thread Joel Kitching
On Mon, 28 Jun 2004 13:41:19 -0500, Jay Blanchard <[EMAIL PROTECTED]> wrote: > If you are going to duplicate code why not just create a generic class > with the code that would be duplicated and then extend the class as > required? > What generic class name would be appropriate in this case? I j

RE: [PHP] OOP, Classes, Sharing Code

2004-06-28 Thread Jay Blanchard
[snip] So my question is, should I just duplicate the code in each class (Portfolio and Album), or is there a better way of organizing all of this? [/snip] If you are going to duplicate code why not just create a generic class with the code that would be duplicated and then extend the class as req

[PHP] OOP, Classes, Sharing Code

2004-06-28 Thread Joel Kitching
I'm kind of new to OOP, so bear with me here... I have a portfolio which contains albums. These albums contain photos. So it would be natural to declare the classes: Portfolio Album Photo It seems to me that none of these classes have the "is a" relationship, and therefore can not be "extended