Re: Classes - Dumb question
| From: | Nathan Nobbe | Date: | Mon, 15 Oct 2007 13:30:26 +0000 |
| Subject: | Re: Classes - Dumb question | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-263207@lists.php.net to get a copy of this message | ||
On 10/15/07, Jay Blanchard <jblanchard@pocket.com> wrote:
>
> [snip]
> >With a class you can inherit all of the base class functionality
> >into a new customer type. You do not have to break open the base
> >class to add a case, you just have to create an extension class.
> >Documentation is unique to each class.
>
> No matter what, you have to break something open to add code -- if
> nothing else, the script.
> [/snip]
>
> The base class would (should?) be contained in its own script space. For
> instance you might have the customer class in a file called
> class.customer.php. You do not have to open this script to add another
> class or extend this class, you would just add another file like
> class.customerCommercial.php that extends the customer class. Since
> autoload is available now (http://www.php.net/autoload) you would not even
> have to open the 'calling' script to add an include line.
>
furthermore using a delegation technique like Stut demonstrated,
you may not even need to edit a file to instantiate the class and call a
method.
-nathan