By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,852 Members | 994 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,852 IT Pros & Developers. It's quick & easy.

Design Pattern help for this scenerio?.

P: n/a
KK
Design Pattern help for this scenerio?.

I need some expert advice on possible ways
to design the classes for following scenerio.

Subject domain has 3 types of identities.
Lets say <IDType1>, <IDType2>. Because
both are identities and have some
commonality we can inherit them from a
base <Identity> type.

Then there is People who owns those IDs.
Some have only 1 ID and some have both.

The problem I have having here is this.
You should be able to add <Identity>
only with a person. So, basicaly I thought
to have a register method inside <Person>
which inturn call [Add] methods in IDentites.

Also, I cannot have [Add] methods inside
the IDType1, IDType2 classes as public
because then it will allow adding identites
without adding a <Person>

Having Identities as inner classes within
<Person> will solve the above issue,
but then, to provide functionality such
as listing/searching IDType1, IDType2
will also have to be done from <Person>
which is a bit silly (I guess)

Using internal keyword may be another
solution. But I think there can be a better
way of doing this.

Any body who can help me
with some design pattern here?

Regards
KK
Jul 21 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.