object oriented programming

Post on 18-Jan-2015

255 Views

Category:

Education

5 Downloads

Preview:

Click to see full reader

DESCRIPTION

 

TRANSCRIPT

OBJECT ORIENTED PROGRAMMING

CONTENTS

Rahul Rastogi1

Introduction

Concepts

Advantages

Disadvantages

INTRODUCTION

Object-oriented programming (OOP – data structures is a programming paradigm using "objects" consisting of data fields and methods together with their interactions – to design applications and computer programs.

Programming techniques may include features such as data abstraction, encapsulation, messaging, modularity, polymorphism, and inheritance.

More complex programs will often group smaller sections of these statements into functions or subroutines each of which might perform a particular task.

Rahul Rastogi 2

OOP’s CONCEPTSOBJECT

CLASS

DATA HIDINGDATA

ABSTRACTION DATA

ENCAPSULATION

INHERITENCEPOLYMORPHIS

M

Rahul Rastogi 3

OBJECT Object is an identifiable entity with some characterstics and

behaviour . Object represents data and its associated functions under

single unit .

For example : “ORANGE” is an object . Its characterstics are – spherical shaped , color is orange . Its behaviour is – it is juicy .

While Programming , the characterstics of an object are represented by its data and its behaviour is represented by its function associated .

Rahul Rastogi 4

Rahul Rastogi 5

CLASS A Class is a group of objects that shares common

properties and relationships .

For example : 1) Cars have been identified as objects . They have characterstics like – steering wheel , a motor ,brakes etc and their behaviour is their mobility .

2) Bird is a class but Parrot is an object .

Rahul Rastogi 6

DATA ENCAPSULATION

The wrapping up of data and functions(that operate on the data) into a single unit is called data encapsulation .

To access the data is provided by functions .

These functions are called member functions in c++ .

Data can not be accessed directly .

“Encapsulation

implements Abstraction”

Rahul Rastogi 7

DATA ABSTRACTION

Abstraction refers to the act of representing essential features without including the background details or explanations .

For example : “SWITCH BOARD”

We only press certain switches according our requirement . What is happening inside , how it is happening etc . We needn’t know .

This is abstraction , we know only the essential things to operate on switch board without knowing the background details of switch board .

INHERITaNCE The relationships of classes through inheritance gives

rise to a hierarchy. Inheritance is the capability of one class of things to

inherit capabilities or properties from another class . Inheritance supports reusability and is transitive in

nature .

Rahul Rastogi 8

POLYMORPHISM

Polymorphism is the “ability for a message or data yo be processed in more than one form” .

Polomorphism is key to the power of oop . Languages that support classes but not polymorphism are

called object-based languages . ‘ADA’ is such a language .

Rahul Rastogi 9

Rahul Rastogi 10

a) Oops is closer to real life representation of the objects which we want to program.

b) Hierarchical relationships can be represented using Inheritance.(reusability, extensability).

c) Data can be divided as public and private.(data protection) .

d) Program development becomes easy due to increased Modularity.(abstraction and encapsulation)

Advantages Of OOPS :

i. OOP is a high level concepts so takes more time to execute as many routines run behind at the time of execution.

ii. Offers less number of functions as compared to low level programming which interacts directly with hardware.

iii. Increased burden on part of OOP developer.

Rahul Rastogi 11

Disadvantages of OOPs

Rahul Rastogi 12

THANK YOU

top related