Home > Blockchain >  How do you show encapsulation in UML class diagram?
How do you show encapsulation in UML class diagram?

Time:04-21

My question is pretty straightforward. How do I represent or show encapsulation when modelling a UML class diagram? Inheritance is modelled using the arrows and an abstract class is shown by having the class name in italics or between the following arrows as shown, << Animals >> but what do you do for encapsulation?

CodePudding user response:

Each feature of a class can have a visibility. Private features make it possible to encapsulate the state of the instance. The notation for a private feature is a - sign in front of its name ( for public, # for protected and ~ for package visibility).

PS: An abstract class is not shown with "arrows". Instead it is shown with the word {abstract} in curly brackets.

PPS: "Arrows" (<<...>>) are not UML notation. You probably mean guillemets: «...». They are used to mark language elements, that don't have a distinct notation, like «use» relationships. They are also used for user defined language elements (=stereotypes).

  • Related