• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Diagrammatic representation of inheritance.

 
Venu Chakravorty
Ranch Hand
Posts: 46
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Consider 2 classes 'Animal' and 'Dog', where 'Dog' is a subclass of 'Animal'. Which one of the following two diagrammatic representations are correct?

Representation 1 (up arrow):
<pre>
Animal
/\
|
Dog
</pre>
This shows that 'Dog' extends 'Animal' and is more specific (narrower) than 'Animal'. Moreover 'Dog' points to it's super class.

Representation 2(down arrow):
<pre>
Animal
|
\/
Dog
</pre>
This shows that 'Dog' has at least all the attributes (ignoring access specifiers) of 'Animal'. It makes me think that these attributes have been imported into 'Dog' and that 'Dog' has come from 'Animal'.

Which one would be right if I were to draw on a paper?

Regards, venu.
 
Wouter Oet
Saloon Keeper
Posts: 2700
IntelliJ IDE Opera
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This has little to do with java, much more with uml. So it would be better to post there. However just google uml class diagram and you will find what your looking for.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic