Anda di halaman 1dari 17

OBJECT-ORIENTED

PROGRAMMING
By: Jessie Nerona

Outline
Objects
Object-Oriented Programming
Classes
Principles of OOP
Benefits of OOP
OOP languages

What is an object?
Objects are key to understanding

object-oriented programming.
Real-world objects share two
characteristics: state (attributes ) and
behaviour ( functions ).

What is an object?
Software objects are conceptually

similar to real-world objects.


An object stores its state in
fields(variables) and exposes its
behaviour through methods(functions).

What is OOP?
Is a programming paradigm based on

the concept of objects.


Objects contain attributes and
procedures.
There is significant diversity of OOP
languages, but the most popular ones
are class-based.

What is a class?
Class is a symbolic representation of

objects.
Class describes the structure of
objects.
Class is a blueprint.

Classes and Objects


Classes describe the structure of

objects, while objects are


usable instances of classes.
Each instance is an exact yet distinct
copy of its class.
Instantiation the act of creating
object.

Principles of OOP
Abstraction
Encapsulation
Inheritance
Polymorphism

Abstraction
ability to represent data at a very

conceptual level without any details.


is the development of classes,
objects, types in terms of their
interfaces and functionality, instead
of their implementation details

Encapsulation
ability to contain and control access to

a group of associated items.


process of combining elements to
create a new entity.
allows you to control how the data and
procedures are used.

Encapsulation
Data Hiding
prevent methods and data form being
used outside of your class
Access modifiers
keywords in object-oriented languages
that set the accessibility of classes,
methods, and other members.

Encapsulation
Access modifiers
used to facilitate the encapsulation of
components.
Examples: Public, Private and Protected

Inheritance
represents the has a, uses a or an

is a relationship between classes.


is the process by which a class can be
derived from a base class with all
features of base class and some of its
own.
increases code reusability.

Polymorphism
Polymorphism means one name,

many forms.
ability to process objects differently
depending on their data type or class.
Two types of polymorphism:
1) Overriding run-time polymorphism
2) Overloading compile-time

polymorphism

Benefits of OOP
Modularity for Easier Troubleshooting
Reuse of Code Through Inheritance
Flexibility Through Polymorphism
Effective Problem Solving

OOP Languages
Java
C++
C#
VB.net
Python
PHP
Ruby
Objective-C
Swift

End