You are here: Re: [PHP] OO: inheritance and function naming « PHP « IT news, forums, messages
Re: [PHP] OO: inheritance and function naming

Posted by "Richard Lynch" on 06/06/05 03:51

On Sun, June 5, 2005 4:56 pm, Script Head said:
> i have the following structure:
>
> class product {
>
> function create() {
> // db stuff
> }
> }
>
> class product_model {
> function create() {
> // db stuff
> }
> }
>
> class product_submodel {
> function create() {
> // db class
> }
> }
>
> i would like class product to extend class product_model and class
> product_model to exten class product_submodel. how would i go about
> this since all three classes contain a method create?

It's EXPECTED that classes have common methods.

If they do *NOT* have any common methods (or properties) they probably
shouldn't be sub-classes of each other.

Inside product_submodel->create() you can call parent::create() to get the
parent's method to fire off.

That's kinda the whole point of it all...


--
Like Music?
http://l-i-e.com/artists.htm

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация