Presentation is loading. Please wait.

Presentation is loading. Please wait.

Object orientation concepts

Similar presentations


Presentation on theme: "Object orientation concepts"— Presentation transcript:

1 Object orientation concepts
Building blocks of modern software practice 9/18/2018 S P Pal

2 Classes and Objects Physical entities User interface components Rules
Controllers Protocols Schedulers 9/18/2018 S P Pal

3 Classes Similar objects constitute a class ADTs (Abstract Data Types)
Operating functions or behavior Object-based languages like SIMULA67 and ADA offer classes or ADTs 9/18/2018 S P Pal

4 Inheritance Reuse of data and behavior specifications
If C2 is a subclass, its instances inherit data and behavior of instances of C1 Collection C2 is a subset if C1 Java supports inheritance and is therefore an object oriented language C++ supports inheritance from multiple classes Inheritance provides flexibility in design Languages like C++ and Java provide inheritance and are called object-oriented 9/18/2018 S P Pal

5 Repeated inheritance Suppose C1 and C2 inherit from B
C3 in turn inherits from both C1 and C2 C3 may clash on some data item or behavior revealing inconsistencies Java avoids this facility and C++ circumvents these problems rather clumsily ! 9/18/2018 S P Pal

6 Inheritance hierarchy
Multiple levels in the inheritance hierarchy provide ease and flexibility in design Define several levels of specialized classes as required in the problem domain e.g., students, PG students, research scholars Create very complex classes that have too many behaviors and data items 9/18/2018 S P Pal

7 Multilevel inheritance
Base C1 C2 C5 C3 C4 9/18/2018 S P Pal

8 Polymorphism Use same name for invoking similar operations irrespective of the types of objects Draw(x1,y1) : draw a point Draw(x1,y1,x2,y2): draw a segment Draw(X1,y1,x2): draw a circle with center at (x1,y1) and radius x2 Graphical-object.draw(…) Simplified code writing Code need not be rewritten: extendible 9/18/2018 S P Pal

9 Parameter passing Pass primitive data types by value
No side effects Functional approach, recursive, stack-based Pass objects by reference Big sized objects may cause stack overflow Objects are persistent entities with global references, not to be copied or destroyed 9/18/2018 S P Pal

10


Download ppt "Object orientation concepts"

Similar presentations


Ads by Google