SlideShare a Scribd company logo
2
Most read
10
Most read
11
Most read
Object and class relationships
2
A CLASS is a template (specification, blueprint)
for a collection of objects that share a common
set of attributes and operations.
Health Club Member
Class
Objects
attributes
operations
Defining Class
UML Class Diagrams 3
What is a Class Diagram?
•A Class Diagram is a diagram describing the
structure of a system shows the system's
•classes
•Attributes
•operations (or methods),
•Relationships among the classes.
4
1 of 2
UML Class Diagram Notation
Class
Member
memberNumber
firstName
lastName
telephone
address
city
etc...
checkOutVideo
checkInVideo
buyItem
etc...
attributes
operations
{
{
Expanded view of a
Class into its three
sections:
Top: Class Name
Middle: attributes
Bottom: operations
5
2 of 2
Object Association
n n
Class
Generalization
Relationship
Object
Aggregation
Association
0..*
1..*
Object Composition
Association
0..*
1
Will always be “1”
UML Class Diagram Notation
UML Class Diagrams 6
Essential Elements of a
UML Class Diagram
Class
Attributes
Operations
Relationships
7
Association
Aggregation/Compostion
Dependencies
Generalization
Realization
8
Associations
An association between two classes describes connection
among them.
If the association is between two classes then it is called
binary association.
There can be association among more than two classes.
It is represented by a solid line.
Example: “An Employee works for a Company”
Employee Company
9
Class A Class B
role A
role B
Company Person
Employer
Employee
Example:
Associations
10
Aggregation & Composition
•Aggregation (shared aggregation):
• is a specialized form of ASSOCIATION in which a whole is
related to its part(s).
• is known as a “part of” or containment relationship and follows
the “has a” heuristic
• three ways to think about aggregations:
• whole-parts
• container-contents
• group-members
• Composition (composite aggregation):
• is a stronger version of AGGREGATION
• the “part(s)” may belong to only ONE whole
• the part(s) are usually expected to “live” and “die” with the whole
(“cascading delete”)
• Aggregation vs. Composition vs. Association???
11
Aggregation Composition
0..*
1..*
Faculty
CourseTeaching
1..*
1
SalesOrder
SalesOrderLineItem
(another: hand --> finger)(another: assembly --> part)
(team-teaching is
possible)
12
Generalization
• Deriving a class out of a parent class having
some inherited property(from the parent
class) and some new property of the derived
class.
• The term generalization is for the
inheritance in the bottom to the up direction
i.e. from derived class to the parent class.
• It is represented by a solid line with a large
arrow head pointing towards the parent
class.
• Example:
13
Vehicle
Car Truck
14
Dependency
• A dependency relationship is a weaker form
of relationship. A dependency states that a
change in specification of one class may
effect another class that uses first one but
not vice versa.
• It is represented by dashed lines.
Dependent class Reference class
15
Realization
• Realization is very similar to inheritance
,the only difference between them is a class
is derived from an interface instead of a
base class.
• An interface is an abstract class.
Interface class Derived class
16
UML Class Diagrams 17
UML Class Diagrams 18

More Related Content

PPTX
FFT and DFT algorithm
PPTX
Object diagram
PPT
Artificial Intelligence and Diagnostics
PPTX
OOP concepts -in-Python programming language
PPTX
Mobile communication
PPTX
Mobile computing
PPTX
Python - An Introduction
FFT and DFT algorithm
Object diagram
Artificial Intelligence and Diagnostics
OOP concepts -in-Python programming language
Mobile communication
Mobile computing
Python - An Introduction

What's hot (20)

PPT
UML Diagrams
PPS
Java Exception handling
ODP
OOP java
PPT
SQLITE Android
PPTX
How java differs from c and c++
PPT
Object Oriented Design
PDF
State chart diagram
PPTX
object oriented Programming ppt
PPT
Basic concept of OOP's
PPTX
Interface in java
PPTX
Classes, objects in JAVA
PPTX
Oop c++class(final).ppt
PPTX
Event Handling in java
PPTX
C# classes objects
PPTX
PPTX
Introduction to Object Oriented Programming
PPT
Java layoutmanager
PPTX
JAVA AWT
PPTX
Object Modeling Techniques
PPT
Unt 3 attributes, methods, relationships-1
UML Diagrams
Java Exception handling
OOP java
SQLITE Android
How java differs from c and c++
Object Oriented Design
State chart diagram
object oriented Programming ppt
Basic concept of OOP's
Interface in java
Classes, objects in JAVA
Oop c++class(final).ppt
Event Handling in java
C# classes objects
Introduction to Object Oriented Programming
Java layoutmanager
JAVA AWT
Object Modeling Techniques
Unt 3 attributes, methods, relationships-1
Ad

Viewers also liked (20)

PPT
Class & Object - Intro
PPT
Object and class
PDF
Parallel Programming in Python: Speeding up your analysis
PPT
Object Oriented Relationships
PPT
Class and object in C++
PPTX
Class and object_diagram
PPT
Object modeling
DOC
Case Study Uml
PDF
Use Case diagram-UML diagram-1
PPTX
Classes And Objects
PPT
DOCX
Java (Netbeans) - Class, Constructor, Object (Object Oriented Programming)
PPT
Unit 3 object analysis-classification
PPTX
Intro to Python Programming Language
PPTX
class and objects
PPT
C++ classes
DOCX
Use case diagram
PPT
Lecture04- Use Case Diagrams
DOCX
E commerce use case documentation.
Class & Object - Intro
Object and class
Parallel Programming in Python: Speeding up your analysis
Object Oriented Relationships
Class and object in C++
Class and object_diagram
Object modeling
Case Study Uml
Use Case diagram-UML diagram-1
Classes And Objects
Java (Netbeans) - Class, Constructor, Object (Object Oriented Programming)
Unit 3 object analysis-classification
Intro to Python Programming Language
class and objects
C++ classes
Use case diagram
Lecture04- Use Case Diagrams
E commerce use case documentation.
Ad

Similar to Object and class relationships (20)

PPT
Uml class-diagram
PPTX
FALLSEM2024-25_SWE2018_ETH_VL2024250103302_2024-10-04_Reference-Material-I.pptx
PPT
PPT
08 class and sequence diagrams
PPTX
Relationships and their representation in a class diagram.pptx
PPT
Selab1 slides
PDF
Software Testing and UML Lab
PPTX
Fundamentals of Software Engineering
PPT
Uml - An Overview
PPT
UML-class_diagram.ppt diagrams ppt download
PPT
UML-class_diagram.ppt
PPT
cse 355 UML class diagram software engineering.ppt
PPT
UML-class diagram for beginners to adance.ppt
PPT
Object oriented programming in C++ programming language
PPT
Introduction to software engineering in data science.ppt
PPT
Object oriented programming language in software engineering
PPT
An Evolution of UML projects.and also what is project
PDF
Introduction to UML, a guide to learn.pdf
Uml class-diagram
FALLSEM2024-25_SWE2018_ETH_VL2024250103302_2024-10-04_Reference-Material-I.pptx
08 class and sequence diagrams
Relationships and their representation in a class diagram.pptx
Selab1 slides
Software Testing and UML Lab
Fundamentals of Software Engineering
Uml - An Overview
UML-class_diagram.ppt diagrams ppt download
UML-class_diagram.ppt
cse 355 UML class diagram software engineering.ppt
UML-class diagram for beginners to adance.ppt
Object oriented programming in C++ programming language
Introduction to software engineering in data science.ppt
Object oriented programming language in software engineering
An Evolution of UML projects.and also what is project
Introduction to UML, a guide to learn.pdf

Recently uploaded (20)

DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PPTX
Foundation to blockchain - A guide to Blockchain Tech
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
PPTX
additive manufacturing of ss316l using mig welding
PPTX
Lecture Notes Electrical Wiring System Components
PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
PPTX
CH1 Production IntroductoryConcepts.pptx
PPT
Mechanical Engineering MATERIALS Selection
PDF
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
PPTX
Internet of Things (IOT) - A guide to understanding
PPTX
web development for engineering and engineering
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PPTX
Welding lecture in detail for understanding
PPTX
bas. eng. economics group 4 presentation 1.pptx
PDF
R24 SURVEYING LAB MANUAL for civil enggi
PPTX
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
PDF
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
PPTX
UNIT 4 Total Quality Management .pptx
PPTX
Construction Project Organization Group 2.pptx
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
Foundation to blockchain - A guide to Blockchain Tech
UNIT-1 - COAL BASED THERMAL POWER PLANTS
additive manufacturing of ss316l using mig welding
Lecture Notes Electrical Wiring System Components
Automation-in-Manufacturing-Chapter-Introduction.pdf
CH1 Production IntroductoryConcepts.pptx
Mechanical Engineering MATERIALS Selection
Mohammad Mahdi Farshadian CV - Prospective PhD Student 2026
Internet of Things (IOT) - A guide to understanding
web development for engineering and engineering
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
Welding lecture in detail for understanding
bas. eng. economics group 4 presentation 1.pptx
R24 SURVEYING LAB MANUAL for civil enggi
IOT PPTs Week 10 Lecture Material.pptx of NPTEL Smart Cities contd
Enhancing Cyber Defense Against Zero-Day Attacks using Ensemble Neural Networks
UNIT 4 Total Quality Management .pptx
Construction Project Organization Group 2.pptx

Object and class relationships

  • 2. 2 A CLASS is a template (specification, blueprint) for a collection of objects that share a common set of attributes and operations. Health Club Member Class Objects attributes operations Defining Class
  • 3. UML Class Diagrams 3 What is a Class Diagram? •A Class Diagram is a diagram describing the structure of a system shows the system's •classes •Attributes •operations (or methods), •Relationships among the classes.
  • 4. 4 1 of 2 UML Class Diagram Notation Class Member memberNumber firstName lastName telephone address city etc... checkOutVideo checkInVideo buyItem etc... attributes operations { { Expanded view of a Class into its three sections: Top: Class Name Middle: attributes Bottom: operations
  • 5. 5 2 of 2 Object Association n n Class Generalization Relationship Object Aggregation Association 0..* 1..* Object Composition Association 0..* 1 Will always be “1” UML Class Diagram Notation
  • 6. UML Class Diagrams 6 Essential Elements of a UML Class Diagram Class Attributes Operations Relationships
  • 8. 8 Associations An association between two classes describes connection among them. If the association is between two classes then it is called binary association. There can be association among more than two classes. It is represented by a solid line. Example: “An Employee works for a Company” Employee Company
  • 9. 9 Class A Class B role A role B Company Person Employer Employee Example: Associations
  • 10. 10 Aggregation & Composition •Aggregation (shared aggregation): • is a specialized form of ASSOCIATION in which a whole is related to its part(s). • is known as a “part of” or containment relationship and follows the “has a” heuristic • three ways to think about aggregations: • whole-parts • container-contents • group-members • Composition (composite aggregation): • is a stronger version of AGGREGATION • the “part(s)” may belong to only ONE whole • the part(s) are usually expected to “live” and “die” with the whole (“cascading delete”) • Aggregation vs. Composition vs. Association???
  • 12. 12 Generalization • Deriving a class out of a parent class having some inherited property(from the parent class) and some new property of the derived class. • The term generalization is for the inheritance in the bottom to the up direction i.e. from derived class to the parent class.
  • 13. • It is represented by a solid line with a large arrow head pointing towards the parent class. • Example: 13 Vehicle Car Truck
  • 14. 14 Dependency • A dependency relationship is a weaker form of relationship. A dependency states that a change in specification of one class may effect another class that uses first one but not vice versa. • It is represented by dashed lines. Dependent class Reference class
  • 15. 15 Realization • Realization is very similar to inheritance ,the only difference between them is a class is derived from an interface instead of a base class. • An interface is an abstract class. Interface class Derived class
  • 16. 16