0% found this document useful (0 votes)
26 views10 pages

Reporting Group 1

Uploaded by

Randy Cañete
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views10 pages

Reporting Group 1

Uploaded by

Randy Cañete
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 10

CLASSES AND OBJECTS

INHERITANCE AND POLYMORPHISM


ENCAPSULATION AND ABSTRACTION
DATA STRUCTURES

BY : GROUP 1
OBJECTIVE-ORIENTED
PROGRAMMING
• Object-oriented programming refers to the concept
in high-level languages such as Java and Python that
uses Objects and classes in their implementations.
OOP has four major building blocks which are,
Polymorphism, Encapsulation, Abstraction, and
Inheritance.
INHERITANCE
• In Java and Python, codes are written in objects or blocks if you are adopting
OOP methodology. Objects can interact with one another by using the properties
of each block or extending the functionalities of a block through inheritance.
Inheritance ensures that codes are reused. There are millions of Java and Python
libraries that a programmer can use through inheritance. The properties of a class
can be inherited and extended by other classes or functions. There are two types
of classes. One is the Parent or base class, and the other is the child class which
can inherit the properties of the parent class. Inheritance is a major pillar in
Object-Oriented programming. It is the mechanism by which classes in Java,
Python, and other OOP languages inherits the attribute of other classes
• Inheritance is concerned with the relationship
between classes and method, which is like a
parent and a child. A child can be born with some
of the attributes of the parents. Inheritance
ensures reusability of codes just the way multiple
children can inherit the attributes of their parents.
POLYMORPHISM
• Polymorphism means existing in many forms. Variables,
functions, and objects can exist in multiple forms in
Java and Python. There are two types of polymorphism
which are run time polymorphism and compile-time
polymorphism. Run time can take a different form while
the application is running and compile-time can take a
different form during compilation.
• Program codes would run differently in a different operating system. The ability of program
code exhibiting different behaviours across the operating system is known as polymorphism
in OOP. You can create a class called “Move” and then four people create animals that
would inherit the move class. But we don’t know the type of animals that they would create.
So polymorphism would allow the animals to move but in different forms based on the
physical features

A creates a Snail that inherits the move class, but the snail would crawl

B creates a Kangaroo that inherits the move class, but the Kangaroo would leap

C creates a Dog that inherits the move class, but the dogs would walk

D creates a Fish that inherits the move class, but the Fish would swim.

Polymorphism has ensured that these animals are all moving but in different forms. How the
programs would behave would not be known until run time.
ENCAPSULATION
• This is a programming style where implementation details are hidden. It
reduces software development complexity greatly. With Encapsulation,
only methods are exposed. The programmer does not have to worry about
implementation details but is only concerned with the operations. For
example, if a developer wants to use a dynamic link library to display date
and time, he does not have to worry about the codes in the date and time
class rather he would simply use the data and time class by using public
variables to call it up. In essence encapsulation is achieved in Python and
Java by creating Private variables to define hidden classes in and then
using public variables to call them up for use.
With this approach, a class can be updated or maintained without worrying
about the methods using them. If you are calling up a class in ten methods and
you need to make changes, you don’t have to update the entire methods rather
you update a single class. Once the class is changed, it automatically updates
the methods accordingly. Encapsulation also ensures that your data is hidden
from external modification. Encapsulation is also known as Data-Hidden.

Encapsulation can be viewed as a shield that protects data from getting


accessed by outside code.

In essence, Encapsulation binds data and code as a single unit and enforces
modularity.
ABSTRACTION

• Abstraction in Java and Python is a programming methodology in which


details of the programming codes are hidden away from the user, and only
the essential things are displayed to the user. Abstraction is concerned
with ideas rather than events. It’s like a user running a program (Web
Browser) without seeing the background codes. Abstraction is achieved in
either Abstract classes or interface in Java and Python. NetBeans and
Eclipse IDE implements abstraction for Java while Django implements
abstraction for Python.
• A programmer uses an Integrated Development
environment to design a UI without worrying about how
the IDE generates the HTML codes. In essence,
abstraction displays the essential details for the user
alone.

You might also like