Ooad Unit 2
Ooad Unit 2
newOperation()
-denotes private attributes – They can be accessed any other class or sub class.
# denotes protected attributes – This visibility can also be accessed by the same class and
within all the immediate children classes of the base class.
~ denotes package attributes – Can be accessed within this class and all the classes which are
inside in a package.
Class Multiplicities Example
Class Multiplicity
Multiplicity Association
• This is the most common type of relationship used in UML. The
association is shown between the classes or instance of classes.
• For example In the figure given below the customer and the bank
account is shown by the association relationship.
• This can be read as “One customer can have multiple accounts in the
bank.” (in an optional type question if all the answers are correct)
Aggregation and Composition
Aggregation implies a relationship where the child can exist
independently of the parent.
Composition implies a relationship where the child cannot exist
independent of the parent.
Class Diagram Example
Class Diagram Example
Domain Model
• Consider a banking system in which a bank has one or more
branches. Each branch has customer which account is present in
that branch. The account can be of two types savings account and
current account. Design the domain model.