Re: Which is better option
3. Have both as member objects.
The relationship between an "employee" and these details is HAS-A in both cases, not IS-A
Re: Which is better option
Quote:
3. Have both as member objects.
What about a Decorator? I think it's appropriate because only some people need Professional Details. And if later he finds out that some people need some ExtraDetails, then the changes needed are minimal.
Re: Which is better option
A good point, it's just that I read the question as implying that all the employees would have both types of details, so that level of flexibility might be classed as over-design in this case. Decorator is certainly worth considering if there was a possibility that professional details might not be applicable, though.
Re: Which is better option
Can you give me details of Decorator
bashish
Re: Which is better option
Re: Which is better option
Not to mention "Design Patterns" by Gamma & Co (Gang of Four) and "Thinking in Patters" in Java or C++ by Bruce Eckel.
Re: Which is better option
Thanks every one.
bashish