Download as pdf or txt
Download as pdf or txt
You are on page 1of 16

y

nl
O
se
U
tre
en
Session: 1 C
h
ec

Introduction to
pt
rA

Object-oriented Programming
Fo

Version 1.0 © 2012 Aptech Limited.


y
nl
 Define Object-oriented Programming (OOP)

O
 Differentiate between Object-oriented and Object-

se
based programming

U
Explain the concepts of OOP

tre

List the advantages and disadvantages of OOP

en

C
h
ec
pt
rA
Fo

Version 1.0 © 2012 Aptech Limited. Object-Oriented Programming Concepts / Session 1 2


y
nl
O
se
U
tre
en
C
h
ec
pt
rA
Fo

Version 1.0 © 2012 Aptech Limited. Object-Oriented Programming Concepts / Session 1 3


y
An object is any

nl
person or a

O
thing, living or

se
non-living which

U
has some

tre
characteristics or

en
Object- attributes which
C oriented
programming
help to describe
h
it
ec

‘Object’ term
concept
pt

1970s
1960s
rA

Smalltalk
Simula 67
Fo

Alan Kay

Version 1.0 © 2012 Aptech Limited. Object-Oriented Programming Concepts / Session 1 4


y
nl
 The figure shows examples of objects in real world.

O
se
U
tre
en
C
h
ec
pt
rA
Fo

Version 1.0 © 2012 Aptech Limited. Object-Oriented Programming Concepts / Session 1 5


y
nl
 OOP –

O
 Makes use of ‘objects’

se
 That are data structures

U
 Consisting of attributes and behavior along with their interactions

tre
en
 For designing computer programs

C
h
ec
pt
rA
Fo

Version 1.0 © 2012 Aptech Limited. Object-Oriented Programming Concepts / Session 1 6


y
nl
OOP Object-based Programming

O
OOP uses a collection of objects that Object-based programming is more or

se
interact with each other to accomplish a less a limited version of OOP.

U
task.

tre
OOP includes features such as Object-based programming has no
abstraction, encapsulation, inheritance, implicit inheritance,

en
modularity, and polymorphism. no polymorphism, and only a reduced
C number of available objects.
h
C++, C#, and Java are some examples of Visual Basic and JavaScript are an
ec

OOP languages. example of Object-based programming


pt

language.
rA
Fo

Version 1.0 © 2012 Aptech Limited. Object-Oriented Programming Concepts / Session 1 7


y
 OOP uses following four programming concepts:

nl
O
se
U
Encapsulation Abstraction

tre
en
C
h
ec
pt

Inheritance Polymorphism
rA
Fo

Version 1.0 © 2012 Aptech Limited. In Object-Oriented Programming Concepts / Session 1 8


y
nl
O
se
U
‘Encapsulate’ means
Used to ‘to
consciously
enclose hide

tre
Used to restrict
information access to some
in a small
something’

en
of the
partdata
of amembers
program by
C
Provides bundlingobjects
of data members and
h
methods into an enclosed structure
ec
pt
rA
Fo

Version 1.0 © 2012 Aptech Limited. Object-Oriented Programming Concepts / Session 1 9


y
nl
 The figure shows how the data members and methods

O
can be encapsulated.

se
U
tre
en
C
h
ec
pt
rA
Fo

Version 1.0 © 2012 Aptech Limited. Object-Oriented Programming Concepts / Session 1 10


y
nl
 Mechanism of showing only the relevant details

O
se
The figure shows an example of abstraction using the

U

ATM machine.

tre
en
C
h
ec
pt
rA
Fo

Version 1.0 © 2012 Aptech Limited. Object-Oriented Programming Concepts / Session 1 11


y
nl
 To pass on characteristics, property, titles,

O
and rights of an individual to his/her

se
successors

U
tre
 Inheritance helps to

en
 Define hierarchical relationships among classes at
different levels C
h
ec

 Give code reusability


pt
rA

 The figure shows that the features and


Fo

characteristics of grandfather are inherited by


father and passed on to his son.
Version 1.0 © 2012 Aptech Limited. Object-Oriented Programming Concepts / Session 1 12
y
Poly Morphos

nl
Assigns a different usage
= =

O
or meaning to something
Many Forms

se
in different contexts

U
tre
en
C
h
ec
pt
rA
Fo

Polymorphism in the real world

Version 1.0 © 2012 Aptech Limited. Object-Oriented Programming Concepts / Session 1 13


y
nl
 Advantages

O
se
U
tre
en
C
h
ec
pt
rA
Fo

Version 1.0 © 2012 Aptech Limited. Object-Oriented Programming Concepts / Session 1 14


y
 Disadvantages

nl
O
se
U
tre
en
C
h
ec
pt
rA
Fo

Version 1.0 © 2012 Aptech Limited. Object-Oriented Programming Concepts / Session 1 15


y
nl
 OOP is a new paradigm in programming that designs programs

O
by making use of ‘objects’, which are a copy of real world

se
entities.

U
 Encapsulation is a feature used to restrict access to some of the

tre
data members by objects.
Abstraction is a mechanism of showing only the relevant details

en

of a process or artifact and hiding the irrelevant details.


 C
Inheritance helps to define hierarchical relationships among
h
classes at different levels and enables code reusability.
ec

Polymorphism is a Greek word which means “many forms” and


pt

an object that can appear in different forms is called a


rA

polymorph.
Fo

Version 1.0 © 2012 Aptech Limited. Object-Oriented Programming Concepts / Session 1 16

You might also like