Oh sure, give me a clear example about 5 days too late...
Just kidding...
Anyways, I have a clear understanding of the difference, thanks.
"Composition can approximate the behavior of MI" is the only assertion I am defending.
A clear message like yours a few days ago would have really helped. I think the thread (that I'm involved with) fell apart pretty early...
Take care,
Joe
>Joseph,
>
>Ok, your example is a good one of approximating MI. The composition mechanism falls down in the class heirarchy though.
>
>Example: Class Person and Employee
>Subclass: Mary (Person and Employee)
>
>MI: Mary "is a" person and mary "is a" employee
>
>Composition: Mary "is a" container
> Mary "has a" person and mary "has a" employee
>
>In MI the issues of the two parents (person and employee) are resolved through the inheritance, mary has the traits of both.
>
>In Composition Mary is a container and has no traits of either person or employee, the container must resolve the traits of the two contained classes through some mechanism (perhaps delegation or meditation).
>
>Composition can approximate the behavior of MI but MI cannot approximate the behavior of composition as MI results in one class while composition results in a composite class containing other classes.
>
>Note that I say approximate, as composition and MI are very different in structure and behavior.
Joseph C. Kempel
Systems Analyst/Programmer
JNC