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/
[Back to original message]
|