Peace,
I would like some help. As far as I've understood thus far:
a "is a" b = inheritance of 'a' from super('b')
a "has a" b = 'b' is a property of class 'a'
now how can I understand the relationship of an interface to a class,
as in:
'a' implements 'b'
Thanks in advance,
God Bless,
shree
> > Hi,
> >
[quoted text clipped - 42 lines]
> HTH,
> La`ie Techie
Chris Uppal - 09 Nov 2006 13:24 GMT
> a "is a" b = inheritance of 'a' from super('b')
> a "has a" b = 'b' is a property of class 'a'
[quoted text clipped - 3 lines]
>
> 'a' implements 'b'
Unless you want to be pedantic, it's essentially the same as the 'is a' for
class/subclass relationship. It tells you that an 'a' is acceptable wherever a
'b' has been asked for.
Still speaking a bit sloppily; the 'is-a' relationship should really be
understood as 'can-be-used-as-if-it-were-a'. E.g: any Mammal can be used as if
it were an Animal. Now with interfaces, what the interface does is specify
what is /needed/ in order to be used as a <something>, so everything which
implements that interface can be used as if it were a <something>.
This could all be made more precise, but it would lead into a discussion of
what wrong with (or at best misleading about) Java's class-based type system,
and I don't think that would help at all just now.
-- chris