0% found this document useful (0 votes)
16 views3 pages

Class Diagram

The class diagram is a static model that shows classes, attributes, operations, and relationships. The main building block is the class, which contains attributes to define an object's state and operations to define its behavior. Attributes can be public, protected, or private and have default visibility of private. Operations can be constructors, queries, or updates and have default visibility of public. Derived attributes are indicated with a slash and unique operations are shown in the class rectangle.

Uploaded by

Red Hub
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views3 pages

Class Diagram

The class diagram is a static model that shows classes, attributes, operations, and relationships. The main building block is the class, which contains attributes to define an object's state and operations to define its behavior. Attributes can be public, protected, or private and have default visibility of private. Operations can be constructors, queries, or updates and have default visibility of public. Derived attributes are indicated with a slash and unique operations are shown in the class rectangle.

Uploaded by

Red Hub
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

CLASS DIAGRAM

The class diagram is a static model of the evolving system.

The main building block of a class diagram is the class, which stores and manages information in
the system.
Each class is drawn by using three part-rectangles with the class’s name at the top, attributes
in the middle, and methods (also called operations) at the bottom.
The attributes of a class and their values define the state of each object that is created from the
class, and the behavior is represented by the methods.

Attributes
Person class in Figure 14-15 contains the attributes lastname, firstname, address, phone,
birthdate, and age.
Derived attribute is age. Because it can be calculated from birth day attribute. Therefore, it is
not stored. Derived attributes are indicated by placing a slash (/) in front of the attribute’s
name.
Visibility

Visibility relates to the level of information hiding to be enforced for the attribute.
 public (+) - not hidden from any other object. As such, other objects can modify their value.
 protected (#) - hidden from all other classes except its immediate subclasses.
 private (-) - hidden from all other classes. The default visibility for an attribute normally is
private.

The default visibility for an attribute normally is private.

Operations
Operations are actions or functions that a class can perform.
The functions that are available to all classes (e.g., create a new instance, return a value for a
particular attribute, set a value for a particular attribute, or delete an instance) are not explicitly
shown within the class rectangle.
Only those operations that are unique to the class are included, such as the “terminate” and
“make offer” operations in Figure 14-15 are shown in the rectangle.
These operations are displayed with parentheses ().
Operations should be shown with parentheses that are either empty, or filled with some value
which represents a parameter that the operation needs for it to act.
As with attributes, the visibility of an operation can be designated as public, protected, or
private. The default visibility for an operation is normally public.
There are three kinds of operations.
 Constructor
 Query
 Update

constructor operation
It creates a new instance of a class.
For example, the vehicle class may have an operation called insert () that creates a new vehicle
instance. Because an operation available to all classes (e.g., create a new instance) is not shown
on class diagrams.

You might also like