Module 8 - Object-Oriented Programming
Module 8 - Object-Oriented Programming
Programming
PPE - Module 8
In this module, you will learn about:
● Class
● Objects
● Abstraction
● Encapsulation
● Inheritance
● Polymorphism
What is a class and an object?
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
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
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
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