A UML Class diagram is a visual representation of the classes and their relations in an object oriented program.

Classes are represented as a combination of:

Example

 class Door {
   - is_closed: bool
   + toggle_is_closed(): void
   - changeLockMechanism(): void
 }

A Door Class.

Note the presence of it’s name, attribues and methods.


Visibility

An attribute or method may be given a prefix to denote it’s visibility to the outside world:

  • public +
  • private -
  • protected #
  • package ~