0% found this document useful (0 votes)
7 views8 pages

OOSD Unit 2

The document discusses class relationships in object-oriented system design using C++, focusing on generalizations (inheritance), associations, and dependencies. It provides examples of class diagrams for various systems such as ATM, hotel management, library management, online shopping, hospital management, and student registration. Each example illustrates the relationships and attributes of the classes involved, emphasizing customization options for different needs.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views8 pages

OOSD Unit 2

The document discusses class relationships in object-oriented system design using C++, focusing on generalizations (inheritance), associations, and dependencies. It provides examples of class diagrams for various systems such as ATM, hotel management, library management, online shopping, hospital management, and student registration. Each example illustrates the relationships and attributes of the classes involved, emphasizing customization options for different needs.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 8

UNIT-II

Object Oriented System Design with C++ (BCS054) 0511-GLBGOI, Mathura

Class Relationships

To create a class diagram, the next step is building relationships. There are three
main types of relationships here:

1. Generalizations
2. Associations
3. Dependencies

Generalizations

Generalizations are often known as Inheritance because it links a subclass to


its superclass. The class diagram allows a subclass to inherit from multiple
superclasses but it can't be used to model interface implementation. Checking,
Savings, and Credit Accounts are generalized by Account

Associations

Association shows a static relationship between two entities. The association


between a student and school is studies.

Compiled By: Nandini Sharma


UNIT-II
Object Oriented System Design with C++ (BCS054) 0511-GLBGOI, Mathura

The multiplicity factor in association represents how many times an attribute is


multiplied. If 100 people work at an organization, then the attribute has
multiplied 100 times.

In aggregation, 2 classes have a whole-part relationship. For example, if an


employee does not come, the organization will remain there.

The aggregation has another special type, called composition. In composition,


a class is strongly connected to another class that it will stop functioning without
it. For example, if an organization closes, all employees will have to leave.

Dependencies

Dependency shows that one class depends on another. Change in one class will
create change in another class. For example, an employee is dependent on the
organization.

Compiled By: Nandini Sharma


UNIT-II
Object Oriented System Design with C++ (BCS054) 0511-GLBGOI, Mathura

Class Diagram Examples of Common Scenarios


1. Class Diagram for ATM

This class diagram for the atm maps out the structure and attributes of how an
ATM works. It also shows the relationship between multiple classes. You can use
this template as it is or modify it according to your needs.

Compiled By: Nandini Sharma


UNIT-II
Object Oriented System Design with C++ (BCS054) 0511-GLBGOI, Mathura

Class Diagram for Hotel Management System

This hotel management class diagram carefully links all classes joining them
together through arrows to show the relationship between them. You can easily
customize this hotel management class diagram and add more classes if you
like.

Class Diagram for Library Management System

The library management system class diagram has multiple classes like the user,
librarian, book, account, etc. It then describes the attributes and operations of
each of the classes linking them together for the library management system.

Compiled By: Nandini Sharma


UNIT-II
Object Oriented System Design with C++ (BCS054) 0511-GLBGOI, Mathura

Class Diagram for Online Shopping

This online shopping class diagram shows the domain model for online shopping.
This diagram will help software engineers and business analysts easily
understand the diagram. The diagram links classes like user and account to
show how an order is placed and then shipped.

Compiled By: Nandini Sharma


UNIT-II
Object Oriented System Design with C++ (BCS054) 0511-GLBGOI, Mathura

Class Diagram for Hospital Management System

If you want to create a hospital management class diagram, this is an excellent


template that you can modify per your needs. This domain model shows several
class diagrams like a patient, staff, treatment, and the relationships between
them.

Compiled By: Nandini Sharma


UNIT-II
Object Oriented System Design with C++ (BCS054) 0511-GLBGOI, Mathura

Class Diagram for Student Registration System

In this class diagram, you can show multiple classes like student, account,
course registration manager, course, etc. This class diagram is fairly easy due to
its linear design. Registration, course, and account are subclasses of the
registration manager and are linked to it using a solid arrow. If your registration
system operates a bit differently, then you can add in new classes and easily
modify this template.

Compiled By: Nandini Sharma


UNIT-II
Object Oriented System Design with C++ (BCS054) 0511-GLBGOI, Mathura

Compiled By: Nandini Sharma

You might also like