You are here: Re: Learning patterns... Decorator « PHP Programming Language « IT news, forums, messages
Re: Learning patterns... Decorator

Posted by Willem Bogaerts on 09/28/07 09:11

> Are you sure I was subclassing? I thought I would have to use
> 'extends' to subclass.

An interface is a purely abstract class. The syntax is different, but
you are still subclassing a (very) generic thing.

> I thought maybe I could have a CLargeProduct that got it's values from
> a database somehow so it was pretty 'generic' and it's values applied
> at run-time based on the db content? And the cost() function wraps
> around or 'decorates' the base passed through the constructor???

The GOF book speaks about "adding responsibility dynamically". The
CLargeProduct class does not add anything dynamically ("at runtime") and
the responsibility is to hand out a value. I don't think a product class
should even be aware of the existence of a database.

Best regards,
--
Willem Bogaerts

Application smith
Kratz B.V.
http://www.kratz.nl/

 

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

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