This week's book giveaway is in the Other Languages forum.
We're giving away four copies of Functional Reactive Programming and have Stephen Blackheath and Anthony Jones on-line!
See this thread for details.
Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

K&B quiz

 
victor kamat
Ranch Hand
Posts: 247
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
In the K&B quiz on the CD one question states that " an is-a relationship always involves at least 2 class types".

I think think is not correct; the correct statement is: "An is-a relationship always involves at at least 1 class type and at least 1 other class type or interface type".

What about it guys ?
 
Svend Rost
Ranch Hand
Posts: 904
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I guess it depends on your definition of a "class type"

how about an interface that implemented an interface? Shouldn't the answer
then be:
An is-a- relationship always involves atleast one class type or interfacetype and atleast one other class type or interface type



/Svend Rost
 
victor kamat
Ranch Hand
Posts: 247
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I like your definition
 
Svend Rost
Ranch Hand
Posts: 904
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by victor kamat:
I like your definition

I didn't define it.. I cant remember how the JLS defines a class type, but
im pretty sure they mean a "Java class" (i.e. not an interface).

My point was, that perhabs the answer is what is is because it'll else get
unnessecary complicated(see the my "proposed answer"). The again.. perhabs
they are wrong .. what do I know

/Svend Rost
 
Javier Sanchez Cerrillo
Ranch Hand
Posts: 152
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So..., An interface "is-a" class type?. If true K&B is OK, otherwise I think as victor posted an error in K & B or an ambiguous question or statement (which i think is an error).
 
Svend Rost
Ranch Hand
Posts: 904
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Javier Sanchez Cerrillo:
So..., An interface "is-a" class type?. If true K&B is OK, otherwise I think as victor posted an error in K & B or an ambiguous question or statement (which i think is an error).


An interface is not a class type, it is an interface type (according to the
JLS).

/Svend Rost
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic