The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
May 2000

Advertisement

Advertisement

This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.

Message:

reply

Posted by vimarsh on January 09, 2001 at 5:37 AM

> What's the difference between Container and the Component.
> Can we inherit the classes between container and the component


if we consider the awt hierarchy , then it is apparrent that component is more general than container.
why so?
consider the following sentence and ponder over it...

container itself is component.
container can contain other components like say Button,label etc.. as it's name suggests.

Now ,concentrate on component.

any thing which can be composed of many things is component.
Here many refers to 1..*
Thus container which contains other components is itself is a larger component.
But, not every component can contain other component. that is everything can't become component. and so the relationship

ANSWER 2.

YOUR question depicts your mis understanding of oop.

in oop ,definatley you can add class in anywhere between class hierarchy. that's not a problem provided there is a class which represents your real world concept.
SO MY QUESTION TO YOU IS THAT IS THERE ANY REAL WORLD THING INBETWEEN COMPONENT AND CONTAINER ?
refer awt hierarcchy to find the answer and reply me.




Replies:

Sponsored Links



Google
  Web Artima.com   
Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us