Originally posted by Mohammed EL-Adawi: ... "Is-a relationship always rely on polymorphism." The Mock exam consider it true, but I think it is false, while its vis-versa is true...
Any type IS its own type (e.g., a String IS-A String), and this is not polymorphism. Also, every type IS-AN Object, but inheritance alone is not polymorphism. So I would say you're correct (unless we want to debate whether "IS-A" implies/requires upcasting).
Originally posted by Mohammed EL-Adawi: ... "Is-a relationship always require at least two classes" The Mock exam consider it true, but I think it is false, except if interface is considered a class in this context...
An interface is not a class. If that's what the question author had in mind, I think they should have used the word "types" rather than "classes." But even so, an Object IS-AN Object (which brings us back to the upcasting question).
Originally posted by Mohammed EL-Adawi: ..."A has B and B has C, this implies A has C" True or false ??? please be sure before answering...
Well, it depends what you mean by "sure," but this question always seems good for a debate centered on what "has" means. [ November 18, 2006: Message edited by: marc weber ]
"We're kind of on the level of crossword puzzle writers... And no one ever goes to them and gives them an award." ~Joe Strummer sscce.org
Joined: Sep 24, 2006
I mean by sure, "you have read it" and you are not guessing like me. I prefer to not see such question in the exam
Hi Have I even mentioned my dislike for poor and vaguely worded mock exam questions?
"Is-a relationship always rely on polymorphism."
This question is non-sensical. As was said before, and Object is-a object. There's no polymorphism there.
"Is-a relationship always require at least two classes"
What is the difference between an orange? A bicycle, because it has no sleeves.
Is-a requires two TYPES. A Type can be a class or an interface. So if the Markable interface extends Serializable, Markable is-a serializable object. There, you have an is-a relationship without any classes.
"A has B and B has C, this implies A has C"
I have a girlfriend and my girlfriend has vd. Does that mean I have vd? Nope.
I have a brain, and my brain has thoughts. Does this mean I have thoughts? Yes it does.
This question does not distinguish between composition and simple association. If this is speaking about association, then it if false. If it is dealing with composition, then it is true.
Man, those questions suck.
My 2 cents worth.
-Cameron McKenzie [ November 18, 2006: Message edited by: Cameron W. McKenzie ]