Professional Documents
Culture Documents
3. Class Operations(Methods)[optional]:
Operations are shown in the third partition. They are services the
class provides.
The return type of a method is shown after the colon at the end of
the method signature. Operations map onto class methods in code
The datatype of method parameters are shown after the colon
following the parameter name
Member visibility
Visibility defines whether attributes and operations of
specific classes can be seen and used by other classes
UML has 4 types of visibility and it is represented by
prefixing a literal( +, -, #, ~)
Member scope
The UML specifies two types of scope for members:
instance and classifier.
Classifier members are commonly recognized as
“static” in many programming languages. The scope is
the class itself.
All the instances share the classifier scoped members.
To indicate a classifier scope for a member, its name
must be underlined. Otherwise, instance scope is
assumed by default.
Instance members are scoped to a specific instance.
Each instantiated object of the class has its own copy of
the instance members
Parameter Directionality
Each parameter in an operation (method) may be
denoted as in,out ,or inout which specifies its direction
with respect to the caller
This directionality is shown before the parameter name.
Relationships between classes
Relationships in class diagrams include different types
of logical connections.
Relationships between classes
1. Dependency
A dependency means the relation between two
or more classes in which a change in one may
force changes in the other.
Dependency indicates that one class depends
on another.
A dashed line with an open arrow
2. Aggregation
A special type of association to represent a "has a"
relationship eg. Team has 9 Players
A solid line with an unfilled diamond at the association end
connected to the class of composite.It models a whole-part
relationship between aggregate and its parts
Eg: class college is made up of one or more student.
In aggregation the contained classes are never totally
dependent on the lifecycle of the container. Here the college
class will remain even if the student is not available
3. Composition
A special type of aggregation where parts are destroyed
when the whole is destroyed.
A solid line with a filled diamond at the association
connected to the class of composite
It denotes strong ownership between two classes when
one class is a part of another class
4. Generalization (Inheritance)
A generalization helps to connect a subclass to its superclass. A
sub-class is inherited from its superclass.
A solid line with a hollow arrowhead that point from the child to
the parent class
Class diagram allows inheriting from multiple superclass
5. Realization (Implements)
Realization relationship is a relationship between two
model elements, in which one model element (the
client) realizes (implements or executes) the behaviour
that the other model element (the supplier) specifies.
6. Association
Represents static relationships between two classes.
Shows that instances of classes could be either linked to each
other or combined logically or physically.
Represented by a solid line (with or without open arrow)
connecting two classes
This kind of relationship represents static relationship
classes A and B
Eg: a person lives at a location
It should be named to indicate the role played by the
class attached at the end of the association path
ATM MACHINE CLASS DIAGRAM
EXAMPLE