RE: [PHP] Re: Design for Large OO poject
| From: | Neil Kimber | Date: | Thu, 08 Nov 2001 17:29:19 +0000 |
| Subject: | RE: [PHP] Re: Design for Large OO poject | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-73920@lists.php.net to get a copy of this message | ||
Errm. You are mistaken. In PHP you can do:
class DB{}
class Member extends DB()
class News extends Member{}
This is not multiple inheritance. This is single inheritance. Multiple
inheritance is when you create a class by 'extending' multiple classes at
one time. You cannot do this in PHP, if you could it would be something
like:
class News extends A, B {}
> -----Original Message-----
> From: Julio Nobrega Trabalhando
> [mailto:inerteARROBAhotmail.com@pb1.pair.com]
> Sent: 08 November 2001 17:27
> To: php-general@lists.php.net
> Subject: [PHP] Re: Design for Large OO poject
>
>
> If I am not mistaken, the correct name for your wrong approach (at least
> in PHP) is multiple inheritance.
>
> PHP doesn't support multiple inheritance, only one level.
>
> So you do can extend one class but not extend the second one from the
> first.
>
> Ie:
>
> > class DB{}
>
> Works.
>
> > class Member extends DB()
>
> Works.
>
> > class News extends Member{}
>
> Doesn't work. Extending an 'extend' class.
>
> http://www.php.net/manual/en/keyword.extends.php
>
> As for the CMS, good luck :-)
>
> One advice, doesn't go too much OO. Depending on the number of features
> you plan to use, it might affect performance.
>
> And one word of caution, code it faster because my own open
> source cms is
> coming soon ;-))))
>
> --
>
> Julio Nobrega
>
> A hora está chegando:
> http://toca.sourceforge.net
> "Daniel Harik" <gatop@hot.ee> wrote in message
> news:1343024288.20011108182448@hot.ee...
> > Hello guys,
> >
> > I've started large long-term project, i'm buildingd my own CMS (content
> > manegment system) with few more developers, compared to nuke i want
> > it to be fully object-oriented, so that adding more modules would be
> > easy and logical, i have built first beta version of it, i want to
> > maximize code reuse, so here is the structure of my classes
> >
> > class DB{}
> > class Member extends DB()
> > class News extends Member{}
> > class Poll extends News{}
> > ...........................
> > All new blocks and modules are added
> > in this place
> > ...........................
> > class NewBlock extends BitOlderBlock{}
> >
> > after this comes the class that's always in the end
> >
> > class Blocks extends NewBlock{}
> >
> > then i have a file that uses all this library
> >
> > looks like this:
> > ---------------
> > <?
> > include ("blocks.php");
> > class mainPage extends Blocks{
> >
> > function displayMainPage(){
> > $this->heading();
> >
> > $this->block_news();
> >
> > $this->footer();
> > }
> >
> >
> > }
> > $page = new mainPage;
> > $page->displayMainPage();
> > ?>
> >
> >
> > --------------
> >
> >
> > I'm very new for big Object-oriented projects, but i'm not new to PHP,
> > i was wondering if my design is good or bad, if you could show me
> > what's wrong with it i'd be very thankful
> >
> > Thank You very much, and have a nice day :-)
> >
> >
> >
> >
> >
> >
> >
> > --
> > Best regards,
> > Daniel mailto:gatop@hot.ee
> >
>
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> For additional commands, e-mail: php-general-help@lists.php.net
> To contact the list administrators, e-mail: php-list-admin@lists.php.net