Professional Documents
Culture Documents
Computer Flip Class
Computer Flip Class
Computer Flip Class
flip
class
I N T RO D U C TI O N A N D
P RI N CI P LE S O F O O P
introduction
As we all know a computer is a problem solving machine, a
computer solves a problem using a set of instructions and data. A
combination of both of these forms a program. Today we are going
to learn about the process of writing and execution of these
programs
INTRODUCTIO
N TO OBJECT
ORIENTED
Programming
Object Oriented programming
(OOP) is a programming
paradigm that relies on the
concept of classes and objects.
It is used to structure a software
program into simple, reusable
pieces of code blueprints (usually
called classes), which are used to
create individual instances of
objects
Object and class
Object - It's a real world entity, simply
everything surrounding us is an object .
It has its own set of attributes, behavior
and state.
Class - In object-oriented programming
, a class is a broad template/blueprint
under which objects having similar
attributes and behavior are grouped.
Principles of object oriented
programming
• Data abstraction
• Encapsulation
• Inheritance
• polymorphism
Data abstraction
Data abstraction is the process
of hiding certain details and
showing only essential
information to the user. It helps
in reducing programming
complexity and efforts.
Real life examples
of data abstraction
Mixer Grinder- The user
only sees jars and buttons
to operate mixer grinder
while technician is more
focused on the motor,
wiring and other internal
details of the mixer
grinder.
In object-oriented programming,
encapsulation refers to the bundling of
data with the methods that operate on
that data, or the restricting of direct
access to some of an object's components.-
Encapsulation is used to hide the values
or state of a structured data object inside
a class, preventing unauthorized parties'
direct access to them.
Real life example
of encapsulation
The real life example of
encapsulation is a washing
machine . The start button of
the washing machine
encapsulates many complex
things in it . Here abstraction
show essential feature like the
start button where
encapsulation hides all the
internal details of washing
that is filling up the water ,
starting the drum , rinsing etc.
Inheritance
Inheritance in Java is a mechanism in
which one class acquires all the properties
and behaviors of a parent class. It is an
important part of OOPs. Inheritance also
represents a relationship which is known as
a parent-child relationship.
real life
example of
inheritance
In real life, there are many good
examples if inheritance. The class
'student' is one of them. If we take
'student' as derived class of the base
class 'Human', then we see that the
class 'student' inherits many
attributes and behavior of the class
'Human'. They share many common
attributes in them such as name and
behavior such as eating, breathing,
sleeping etc. If we take one more
example on the derived class 'car' and
base class 'automobiles', we see that
they share common attributes such
as manufacturer, model no. etc.
and some common behavior such as
accelerating, applying brakes etc.
Polymorphism
Polymorphism is an ability of an
object to take multiple forms . In
simple words we can say that
polymorphism in java allows us to
perform the same action in many
different ways.
Real life examples
of polymorphism
1)A person at the same time can have
different characteristic. Like a man at the
same time is a father, a husband, an
employee. So the same person posses
different behavior in different situations.