I would make four classes:
Manufacturer, Publisher, Distributor which each have information
specific to their scope and there is no inheritance relationship
between these classes--they're totally independent.
Then have one Company class which has the generic info all companies
have and then an optional instance of Manufacturer, Publisher,
Distributor. So each Company instance can be a Manufacturer,
Publisher, and/or Distributor based on it's composed classes. You
could create helper classes fo IsXXX and whatever else is needed to
make this scenario quicker to program.
HTH,
Sam
------------------------------------------------------------
We're hiring! B-Line Medical is seeking Mid/Sr. .NET
Developers for exciting positions in medical product
development in MD/DC. Work with a variety of technologies
in a relaxed team environment. See ads on Dice.com.
On 2 Jan 2007 09:25:00 -0800, "Froefel" <hansdeschryver@gmail.com>
wrote:
Quote:
>I'm trying to modem a relationship with classes and I'm having trouble
>finding the correct design pattern. Maybe someone with more experience
>knows which pattern(s) I'm looking for. Here's an explanation of what I
>have and in which direction I'm thinking:
>
>CLASS DESIGN
>=============
>1. Generic class "Company" contains general company information (name,
>address, reference person, phone, etc...)
>
>2. A class "Manufacturer", which is another type of company with a
>particular function, namely that they manufacture products. It has
>manufacturer-specific properties
>
>3. A class "Publisher", which is a type of company with a particular
>function, namely that they publish books. They could be considered a
>"Manufacturer" as well, since they create books, but they do more than
>just create them... they also publish them, and that's an action that
>doesn"t apply to manufacturers in general. This class also has
>publisher-specific properties.
>
>4. A class "Distributor", which is yet another type of company with a
>particular function, namely that they distribute products. They don't
>necessarily create products, but only distribute them.
>This class has distributor-specific properties.
>
>5. A class CompanyFactory, which is responsible for company-related
>actions such as CRUD actions, listing methods, etc...
>
>