Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you model polymorphism & instances in UML?

Tags:

oop

uml

I am finding it difficult to model polymorphism and instances in UML.

For example if i have an abstract, parent or base class called "Bird", i would imagine that you could say that "duck" is one form of polymorphism but it could also be an instance.

Maybe, i'm confusing where one starts and ends. Are there visual examples of these?

like image 375
PeanutsMonkey Avatar asked Sep 10 '25 04:09

PeanutsMonkey


1 Answers

It is simple enough.

If one concrete class Cage has reference to abstract class Bird, and concrete classes Woodpecker and Canary are derived from the last, this is polymorphism. You'll have to choose what bird really will sit in the cage, for abstract class has no instances. The same for Interface.

enter image description here

like image 121
Gangnus Avatar answered Sep 13 '25 15:09

Gangnus