Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
15 views

Module 8 - Object-Oriented Programming

Uploaded by

merryfil.adolfo
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Module 8 - Object-Oriented Programming

Uploaded by

merryfil.adolfo
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 20

Object-Oriented

Programming

PPE - Module 8
In this module, you will learn about:

● Basic concepts of object-oriented programming (OOP)


● The differences between the procedural and object approaches (motivations
and profits)
● Classes, objects, properties, and methods;
● Designing reusable classes and creating objects;
● Inheritance and polymorphism;
OOP

Object-oriented programming (OOP) is a computer programming model that


organizes software design around data, or objects, rather than functions and logic.

Object-oriented programming (OOP) refers to a type of computer programming


(software design) in which programmers define the data type of a data structure,
and also the types of operations (functions) that can be applied to the data
structure. In this way, the data structure becomes an object that includes both
data and functions.
OOP Concepts

● Class
● Objects
● Abstraction
● Encapsulation
● Inheritance
● Polymorphism
What is a class and an object?

A class (among other definitions) is a set of objects. An object is a being belonging


to a class.

An object is an incarnation of the requirements, traits, and qualities assigned to a


specific class. This may sound simple, but note the following important
circumstances. Classes form a hierarchy.

This may mean that an object belonging to a specific class belongs to all the
superclasses at the same time. It may also mean that any object belonging to a
superclass may not belong to any of its subclasses.
What is a class and an object? (cont.)
Simulation [25]
Abstraction

Abstraction is one of the key concepts of object-oriented programming (OOP)


languages.

Its main goal is to handle complexity by hiding unnecessary details from the user.
That enables the user to implement more complex logic on top of the provided
abstraction without understanding or even thinking about all the hidden
complexity.
Simulation [26]
Encapsulation

Encapsulation is one of the fundamental concepts in object-oriented programming


(OOP). It describes the idea of bundling data and methods that work on that data
within one unit, e.g., a class in Java.

This concept is also often used to hide the internal representation, or state, of an
object from the outside. This is called information hiding. The general idea of this
mechanism is simple. If you have an attribute that is not visible from the outside of
an object, and bundle it with methods that provide read or write access to it, then
you can hide specific information and control access to the internal state of the
object.
Encapsulation(cont.)

Access Modifiers
● Public – accessible outside the class
● Protected – accessible by subclasses (or class derived from it)
● Private – accessible inside the class only
Simulation [27]
Problem set [20]
Inheritance

Let's define one of the fundamental concepts of object programming, named


inheritance. Any object bound to a specific level of a class hierarchy inherits all the
traits (as well as the requirements and qualities) defined inside any of the
superclasses.

The object's home class may define new traits (as well as requirements and
qualities) which will be inherited by any of its subclasses.
Inheritance(cont.)
Inheritance(cont.)
Simulation [28]
Polymorphism

The word polymorphism is used in various contexts and describes situations in


which something occurs in several different forms. In computer science, it
describes the concept that objects of different types can be accessed through the
same interface. Each type can provide its own, independent implementation of
this interface. It is one of the core concepts of object-oriented programming (OOP).
Simulation [29]
Problem Set [21]

You might also like