3.3.1 How to Represent Abstraction in a Class Diagram

Most all things, including classes, can be abstract. Let's look at a few different ways things will be represented as abstract in class diagrams.

Classes

We can tell that a class is abstract by looking at the class header and checking for the abstract keyword.

To represent this on a class diagram, we will add the <abstract> notation next to the class header.

Properties and Methods

We can tell that a property or method is abstract by looking at the class header and checking for the abstract keyword. Abstract methods also cannot declare a method body; more on that later.

To represent this on a class diagram, we will add the <abstract> notation next to the method.

We aren't done, however. Whenever a method/property is made abstract there needs to be an override of that method declared in the descendant class.