In a UML diagram, when should a class be abstract?

In a UML diagram, when should a class be abstract? Just when do we want to prevent instantiation?

Edit: Can an abstract class fully implement a method (when the method depends only on the attributes of this abstract class)?

+5
source share
7 answers

Preventing instantiation is an implementation issue, so this is a good reason if you are thinking of Java, C #, etc.

However, at the modeling level, you want to make an abstraction of the class if there are several subclasses, and it makes no sense that the object has a supertype, but not one of the subtypes.

, , . , , , .. .

EDIT: !

+6

, , .

UML {abstract}.

( 70 UML Distilled Third Edition ) , : enter image description here

+6

a , , UML.
, :

, , , . , .

, FileLogger EmailLogger Logger, , , .

+4

, , ().

. . isAlive(). . move (target). -. . , .

0

, , , Cat - Animal.

, Animal , Eat, .

0

, , .

, .

0

and an abstract class means that you can maintain a list of methods or variables (open static final by default inside an abstract class), this imposes a class that extends this abstract class to implement methods that are not implemented in the declared abstract class (an abstract class has a large similarities to interfaces, but the only difference is that interfaces are 100% abstract classes).

0
source

All Articles