Skip to content

Class Diagram

Describes system's classes, attributes, behaviors and relationships.

Visibility

Determines which attributes and behaviors are visible outside of the class.

  • + for public
  • - for private
  • # for protected

Relationships

Composition

Also known as composite aggregation, is a relationship where the lifecycle of the composing object is dependent on the lifecycle of composed objects.
In other words, If the composed object is destroyed, then its components are also destroyed.

classDiagram
Car *-- Engine

Aggregation

In this relationship, the lifecycles of both, composed and composing objects is independent of each other.

classDiagram
Pond o-- Duck

Inheritance

If two or more classes possess some amount of attributes or behaviors as common, we can abstract them away into a container called

  • Parent class
  • Base class
  • Super class
classDiagram
Person <|-- Student
Person <|-- Professor

The classes possessing those attributes and behaviors, are called

  • Child class
  • Derived class
  • Sub class

References

Read about class diagram.