A class diagram is at the heart of UML. It represents the core purposes of UML because it separates the design elements from the coding of the system. UML was set up as a standardized model to describe an object-oriented programming approach. Since classes are the building block of objects, class diagrams are the building blocks of UML. The diagramming components in a class diagram can represent the classes that will actually be programmed, the main objects, or the interaction between class and object. The UML shape library in Lucidchart can help you create nearly any custom class diagram.
Basics of Class Diagrams
Class - Diagram Anatomy
The class diagram is composed of three parts:
Upper section - Name of the class - This section is always required whether you are talking about the classifier or an object.
Middle Section - Attributes of the class - The attributes describe the variables that describe the qualities of the class. This is only required when describing a specific instance of a class.
Bottom section - Class operations (methods) - Displayed in list format, each operation takes up its own line. The operations describe how a class can interact with data.
Member Access Modifier
All classes have different access levels depending on the access modifier (visiblity). Here are the following access levels with their corresponding symbols:
Public (+)
Private (-)
Protected (#)
Package (~)
Derived (/)
Static (underlined)
Member Scope
There are two scopes for members: classifiers and instances. Classifiers are static members while instances are the specific instances of the class. If you are familiar with basic OO theory, this isn't anything groundbreaking.
Object / Class Interactions in Class Diagrams
Interactions between objects and classes are an integral part of class diagrams.
Inheritance
Inheritance is when a child object assumes all the characteristics of its parent object. For example, if we had the object