1 / 10

Object orientation concepts

Object orientation concepts. Building blocks of modern software practice. Classes and Objects. Physical entities User interface components Rules Controllers Protocols Schedulers. Classes. Similar objects constitute a class ADTs (Abstract Data Types) Data

quanda
Download Presentation

Object orientation concepts

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Object orientation concepts Building blocks of modern software practice S P Pal

  2. Classes and Objects • Physical entities • User interface components • Rules • Controllers • Protocols • Schedulers S P Pal

  3. Classes • Similar objects constitute a class • ADTs (Abstract Data Types) • Data • Operating functions or behavior Object-based languages like SIMULA67 and ADA offer classes or ADTs 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 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 ! 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 S P Pal

  7. Multilevel inheritance Base C1 C2 C5 C3 C4 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 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 S P Pal

More Related