Superclass Subclass and Inheritance
Superclass Subclass and Inheritance
Prepared BY :
Mukhtar Qureshi
Subclasses, Superclasses, Inheritance
d
salary100000, Sex=M salary100000, Sex=F
High-Pay-Male High-Pay-Female
Slide 13
Discussions
Slide 14
An Attribute-defined Specialization
EMPLOYEE
Sex
d
M F
Male-EMP Female-EMP
Slide 15
Attribute Inheritance in Superclass /
Subclass Relationships
An entity that is member of a subclass inherits
All attributes of the entity as a member of the
superclass
All relationships of the entity as a member of the
superclass
Example:
SECRETARY inherit the attributes Name, SSN, …,
from EMPLOYEE
SECRETARY can have additional attributes
specific to secretaries (typing speed, …)
Slide 16
Additional attributes in subclasses
Slide 17
Overlapping Specialization
In an overlapping specialization, indicated by an
circled o, an entity in the superclass can belong to
more than one subclasses.
DEPARTMENT
o
Has a location in DC Has a location in NY
Located-in-DC Located-in-NY
Slide 18
Further Discussions
EMPLOYEE
salary100000
High-Pay-EMP
Slide 19
Summary
Four types of specializations
Total (double-lined), disjoint (d)
Partial (single-lined), disjoint (d)
Total (double-lined), overlapping (o)
Partial (single-lined), overlapping (o)
A subclass may have its own (additional)
attributes
A superclass may have more than one
specialization.
Slide 20
Example of Overlapping Total
Specialization
Slide 21
Multiple Specializations
Slide 22
User-Defined
Specialization/Generalization
Slide 23
Specialization/Generalization Hierarchies,
Lattices & Shared Subclasses (1)
Slide 24
Shared Subclass “Engineering_Manager”
Slide 25
Categories (UNION TYPES)
Slide 27
28
EER diagram notation to represent
subclasses and specialization
Slide 29