Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

IS-A confusion with practise exam question

 
Stephen Pengilley
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,

One of the questions in the practise program for exams asks whether the following statement is true

'is-a relationships always require at least two class types.'

I didn't think this was true but apparently I am wrong. The practise exam says that it is true!

However,

interface foo {}

class bar implements foo {}

uses inheritance and passes is-a. But there is only one class type isn't there?

Would appreciate an explanation so I know which is true.

Regards
Stephen
 
K. Tsang
Bartender
Posts: 3355
12
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What's your definition of a "class type"? Is an interface a class type?

So whether you say "class A extends B {}" or "class A implements B {}": A is a B.
 
fred rosenberger
lowercase baba
Bartender
Posts: 12089
29
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I suppose there is a difference between a "class type" and a "class".
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic