You are on page 1of 9

UNIFIED MODELING LANGUAGE

(UML)
Class and Objects Diagrams

Dr. Myat Mon Kyaw


Faculty of Information Science
University of Computer Studies (Yangon)

1
Outlines
 Data Types  Aggregation
 Classes  Composition
 Describing Objects With Classes  Association Classes
 Associations  N-array Associations
 Generalization And Specialization  Qualified Associations
 Inheritance Of Attributes And  Interfaces
Operations  Templates

2
Inheritance
 Process by which properties of a class are automatically define for all
descendent classes.
 All the attributes and operations defined in the ancestors of a class are also
features of the class itself.
 Common features shared by a number of classes can be defined in one place
Available in a number of different classes

3
Inheritance (Cont’d)
 Inherited features also belong to subclasses

Figure 8.29 : Account hierarchy with inheritance

 Effect : Avoiding repetition and making hierarchies clearer and easier to


read
4
Modifying Subclasses
 Subclasses can:
 add features to model special properties
 override operations to implement specialized behaviour

Figure 8.29 : Account hierarchy with inheritance 5


Overriding Operations In Subclasses
 Instead of adding a new operation, a class requires a modified version
of an operation that it has inherited.
 When a class provides a redefinition of an inherited operation, it is said
to override the inherited feature.
 Overriding is indicated by writing the name of the overridden
operations in the subclass that redefines it.

Figure 8.13: Partial account hierarchy, overwriting the ‘withdraw’ and ‘deposit’ operation
6
Abstract Operations
 Some operations cannot be implemented in abstract classes
 Any class containing an abstract operation must be an abstract class.
 An abstract operation must be overridden in descendant classes by a non-
abstract operation

Figure : Hierarchy of Shapes, with Abstract Class and Abstract Operation

7
Summary

 Inheritance
 Modifying Subclasses
 Abstract Operations

8
Next Lecture
Thank You.

Aggregation

You might also like