Presentation is loading. Please wait.

Presentation is loading. Please wait.

Object Oriented Concepts -II

Similar presentations


Presentation on theme: "Object Oriented Concepts -II"— Presentation transcript:

1 Object Oriented Concepts -II

2 18.1 Inheritance Inheritance is a mechanism for defining a new class in terms of an existing class. Object classes may inherit attributes and services from other object classes. Inheritance represents the generalization of a class. An example of generalisation hierarchy is represented as follows.

3 18.2 Inheritance: A Generalization Example

4 18.3 Multiple Inheritance A system which supports multiple inheritances allows object classes to inherit from several super-classes. It can lead to semantic conflicts where attributes/services with the same name in different super-classes have different semantics. It makes class hierarchy reorganisation more complex. One way of achieving the benefits of multiple inheritance in a language with single inheritance is to inherit from the most appropriate class and then add an object of another class as an attribute.

5 18.4 Multiple Inheritance contd..

6 18.5 Advantages of inheritance
It is an abstraction mechanism which may be used to classify entities It is a reuse mechanism at both the design and the programming level The inheritance graph is a source of organisational knowledge about domains and systems

7 18.6 Problems with inheritance
Object classes are not self-contained. they cannot be understood without reference to their super-classes Designers have a tendency to reuse the inheritance graph created during analysis. Can lead to significant inefficiency The inheritance graphs of analysis, design and implementation have different functions and should be separately maintained

8 18.7 Polymorphism The ability of different objects to perform the appropriate method in response to the same message is known as polymorphism. The selection of the appropriate method depends on the class used to create the object. Shape Square Circle name getName( ) calculateArea( ) side radius

9 18.8 Abstraction Data abstraction is a benefit of the object-oriented concept that incorporates encapsulation and polymorphism. Data are abstracted when they are shielded by a full set of methods and only those methods can access the data portion of an object. Example: Abstract of a Project

10 18.9 Class Hierarchy An object-oriented system organizes classes into a subclass-super class hierarchy. Different properties and behaviours are used as the basis for making distinctions between classes and subclasses. At the top of the class hierarchy are the most general classes and at the bottom are the most specific. A General Class Hierarchy of Library is represented as follows

11 18.10 Class Hierarchy : Library Example

12 18.11 Benefits of Object Orientation
Object technology emphasizes modelling the real world and provides us with the stronger equivalence of the real world‘s entities (objects) than other methodologies. Faster development Managed complexity Increased reusability and extendibility Increased quality and reliability

13 18.12 Drawbacks However the object oriented technology suffers from the following limitations It requires greater concentration on requirements, analysis and design. Developers need to work closely with customers Provide only long term benefits Insists more on testing


Download ppt "Object Oriented Concepts -II"

Similar presentations


Ads by Google