0% found this document useful (0 votes)
19 views15 pages

Oops Shortened

Uploaded by

sarfarz
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)
19 views15 pages

Oops Shortened

Uploaded by

sarfarz
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/ 15

OOPS CONCEPTS

■ The object is Real-world entities i.e Pen, Paper, computer, watch, fan, etc.
■ Object-Oriented Programming is a methodology to implement real-world
entities by designing a program using classes and objects.
■ OOPS(Object-Oriented programming System) provides a paradigm to simplifies
the development and maintenance of a Software. 
Main concepts of OOPS

• Object
• Class
• Inheritance
• Polymorphism
• Abstraction
• Encapsulation
■ Dynamic binding
■ Message passing
object

■ A physical or logical entity that has state and behavior is known as an


object. For Example Pen, Paper, computer, watch fan, etc.
■ Example 1:
Object: House
State: Address, Color, Area
Behavior: Open door, close door
■ In software program state is called data and behaviour is called
method.
■ Object is an instance of a class
CLASS
■ The collection of objects is called a class.
■ Class is the blueprint of an object from which object created.
■ Class doesn’t consume space.
■ A class has data and method .
■ Class is known as OBJECT FACTORY
ABSTRACTION

■ Abstraction refers to an act of representing essential features without including


background details.
■ Example: 1. we operate ATM machine but don’t know about internal mechanism
■ 2. In order to drive a car we are only aware of some essential external features like
steering,accelerator,clutch,brake,gears… but unaware of the mechanism of
engine of a car.
■ Abstraction can be achieved by
• Abstract Class and abstract method
• Interface
ENCAPSULATION

■ Wrapping of data and functions into a single unit.


■ Encapsulation is used for access restriction to class members and methods.
■ Access modifiers  keywords are used for encapsulation in object oriented
programming. For example, encapsulation in java is achieved using public,
private and protected.
REAL TIME EXAMPLE OF
ENCAPSULATION
■ one of the real world example of encapsulation is Capsule, as capsule
binds all it's medicinal materials within it, similarly in java
encapsulation units(class, interface, enums etc) encloses all it's data
and behavior within it.
INHERITANCE

■ Inheritance is a process where child class acquires all the properties and behaviors
of the parent class.
■ Inheritance is used when one object is based on another object.
■ Here parent class also called a superclass and child class called as a subclass.
■ For Example,  Person is Parent class and Employee is a subclass of Person. which
acquired all the properties and behavior of Person class.
JAVA does not support multiple inheritance through classes.
■ It is implemented with the help of interfaces
POLYMORPHISM

■ Polymorphism is the concept where an object behaves differently in different


situations.
■ There are two types of polymorphism – compile time polymorphism and
runtime polymorphism.
METHOD OVERLOADING AND
OVERRIDING
■ When two or more methods in the same class have the same name
but different parameters, it's called Overloading.

■ When the method signature (name and parameters) are the


same in the parent class and the child class, but implementation
is different it's called Overriding.
REAL TIME EXAMPLE OF
POLYMORPHISM
■ Suppose if you are in class room that time you behave like a student, when you are in
market at that time you behave like a customer, when you at your home at that time you
behave like a son or daughter, Here one person present in different-different behaviors.
■ Sometime your mobile behaves as a phone, sometime as a camera,
sometime as a radio etc. Here the same mobile phone has different
forms, so we can say the mobile object is polymorphic in nature.

You might also like