SlideShare a Scribd company logo
1 of 22
Object Oriented
Programming
Concepts
By:Apeksha Jadhav
Poornima
Ramya
Sanmati RM
Yashaswini S
TABLE OF CONTENTS
1. Introduction to OOPS
2. Characteristics of OOPS : Objects
Classes
Polymorphism
Overloading
Overriding
Abstraction
Data Encapsulation
Inheritance
Creation of Objects
1. Calling objects using Methods
2. Difference between OOPs and Procedure Based
Programming
WHY OOPS?
● OOP was introduced to overcome flaws in the procedural approach to
programming
● Such as lack of reusability and maintainability
Machine Language
Assembly Language
Structured
Programming
Language
Procedural
Programming
Language
Object Oriented
Programming
WHAT IS OOPS?
● Object oriented programming (OOP) is a programming technique in which
programs are written on the basis of objects
● In OOP, problem is divided into number of entities called objects and then
builds data and functions around these objects
● Data of objects can be accessed only by the functions associated with the
objects
● Communication between objects is done through functions
● Follows bottom-up approach in program design
OBJECTS
● Object is the basic unit of object oriented programming.Objects are identified by its
unique name.
● An object represents a particular instance of a class.They may represent a person,a place
or any item that the program must handle
● An object is a collection of data members and associated member functions also known
as methods.
CLASSES
● Classes are data types based on which objects are created.
● Thus a class represents a set of individual objects.
● Objects are variables of class.
● A class is a collection of objects of similar type.
● Example: Student ram, sham;
● In example ram and sham are name of objects fo class Student,We can create any
number of objects for class
CHARACTERISTICS:POLYMORPHISM
● Polymorphism is derived from 2 greek words: poly and morphs. The word "poly"
means many and "morphs" means forms. So polymorphism means many forms.
● Polymorphism is an object-oriented programming concept that refers to the ability of a
variable,function or object to take on multiple forms.
● 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.
Compile time polymorphism: It is also known as static polymorphism. This type of
polymorphism is achieved by function overloading or operator overloading.
Runtime polymorphism: It is also known as Dynamic Method Dispatch. It is a process in which
a function call to the overridden method is resolved at Runtime. This type of polymorphism is
achieved by Method Overriding.
OVERLOADING
● When there are multiple functions with same name but different parameters
then these functions are said to be overloaded. Functions can be overloaded by
change in number of arguments or/and change in type of arguments.
● Example: 1)By using different types of arguments
● 2) We can make the operator (‘+’) for string class to concatenate two strings.
We know that this is the addition operator whose task is to add two operands.
So a single operator ‘+’ when placed between integer operands, adds them and
when placed between string operands, concatenates them.
OVERRIDING
● Method overriding, occurs when a derived class has a definition for one of the
member functions of the base class. That base function is said to be
overridden.
● You can have a method in subclass
overrides the method in its
super classes with the same name
and signature.
Lorem ipsum dolor sit amet, consectetur
adipiscing elit. Curabitur eleifend a diam
quis suscipit. Fusce venenatis nunc ut
lectus convallis, sit amet egestas mi
rutrum. Maecenas molestie ultricies
euismod. Morbi a rutrum nisl. Vestibulum
laoreet enim id sem fermentum, sed
aliquam arcu dictum. Donec ultrices diam
sagittis nibh pellentesque eleifend.
CHARACTERISTICS:ABSTRACTION
● Providing only essential information about the data
to the outside world, hiding the background details
or implementation.
● Need to know:
○ Methods of the object are available
○ Input parameters needed
● Need not know:
○ How the method is implemented?
○ Which kinds of actions it has to perform?
● Example:The man only knows applying brakes will
stop the car but he does not know about the inner
mechanism of the car.
CHARACTERISTICS:ENCAPSULATION
Lorem Ipsum
● Binds together the data and functions that
manipulate the data.
● Hide the internal representation, or state, of an
object from the outside. This is called information
hiding.
● Example: Calculator
○ Press 2+2 then see the result on display.
○ Don't have to know how it works inside.
● Advantages
○ Control over the data
○ Data hiding
ENCAPSULATION ~ ABSTRACTION??????
CHARACTERISTICS:INHERITANCE
● Mechanism in which one object acquires all
the properties and behaviors of a parent
object.
● The “extends” keyword indicates that you
are making a new class that derives from an
existing class.
● Why use it:
○ For Method Overriding
○ For Code Reusability
class Animal{
void
eat(){System.out.println("eating...");}
}
class Dog extends Animal{
void bark()
{System.out.println("barking...");}
}
class TestInheritance{
public static void main(String args[]){
Dog d=new Dog();
d.bark();
d.eat();
}}
CREATION OF OBJECTS
How to Declare, Create and Initialize an Object in Java
A class is a blueprint for Object, you can create an object from a class. Let's take
Student class and try to create Java object for it.
Let's create a simple Student class which has name and college fields.
Let's write a program to create declare, create and initialize a Student object in
Java.
public class Student {
private String name;
private String college;
public Student(String n, String c) {
name = n;
college = c;
}
public static void main(String[] args) {
Student student = new Student("Ramesh",
"BVB");
Student student2 = new Student("Prakash",
"GEC");
Student student3 = new Student("Pramod",
"IIT");}
}
Simple Program Demonstrating The Creation Of Objects
Using ‘New’ Keyword
From the above program, the Student objects are:
Student student = new Student("Ramesh", "BVB");
Student student2 = new Student("Prakash", "GEC");
Student student3 = new Student("Pramod", "IIT");
Each of these statements has three parts:
Declaration: The code Student student; declarations that associate
a variable name with an object type.
Instantiation: The new keyword is a Java operator that creates the
object.
Initialization: The new operator is followed by a call to a
constructor, which initializes the new object.
CALLING OBJECTS USING METHODS
Now, we have the complete program below which creates three Student objects and invokes
the printDetails() method on each of these objects.
public class StudentTest {
public void printdetails(String name,String
college)
{
System.out.println(“Name of
student is: “+ name + “n”);
System.out.println(“Name of
college student is studying in: “+ college +
“n”);
}
public static void main ( String[] args ) {
Student s1 = new Student
(“Ramesh”,”BVB”) ;
Student s2 = new Student ( "Prakash", “GEC” );
Student s3 = new Student ( "Pramod" , “IIT”);
System.out.println("Student s1:n ");
s1.printDetails();
System.out.println("nStudent s2: ");
s2.printDetails();
System.out.println("nStudent s3: ");
s3.printDetails(); }
When we run this program, we get the following output:
Student s1:
Name of student is: Ramesh
Name of college student is studying in is: BVB
Student s2:
Name of student is: Prakash
Name of college student is studying in is: GEC
Student s3:
Name of student is: Pramod
Name of college student is studying in is: IIT
Now that we have created the objects, we will look into how the variables and methods of these objects
can be accessed. In order to access a variable or a method, we use the reference/dot operator (.) in the
following way:
s1.printDetails();
The above statement invokes the printDetails() method on the Student object s1. If the method requires
arguments, we state them within the parentheses. Variables too are accessed in a similar way, except
that the parentheses are not included. This is what separates the variables from methods and helps us
to distinguish between the two. If the name variable was public we could have used the following
statement to assign a String to the name variables of s1 in the following way:
s1.name="Ram";
We can also print these values, as we would have printed a String variable if the variable was declared
as public.
System.out.println("Name is "+ s1.name);
But, for the current objects such access is denied since the variables were declared to be private which
means that the variables are not accessible outside the class.
DIFFERENCE BETWEEN OBJECT ORIENTED PROGRAMMING AND
PROCEDURAL PROGRAMMING
Object Based Programming Procedure-Based Programming
Focuses on data Focuses on doing things(functions)
Follows bottom-up approach Follows top-down approach
Data abstraction and data hiding feature
prevents accidental change in data
Use of global variables puts the data at risk
Extending the program is easier than
procedure-based programming
Extending the program is a difficult task
THANK YOU

More Related Content

What's hot

Object Oriented Concepts and Principles
Object Oriented Concepts and PrinciplesObject Oriented Concepts and Principles
Object Oriented Concepts and Principlesdeonpmeyer
 
Object Oriented Programming using C++ Part II
Object Oriented Programming using C++ Part IIObject Oriented Programming using C++ Part II
Object Oriented Programming using C++ Part IIAjit Nayak
 
4 pillars of OOPS CONCEPT
4 pillars of OOPS CONCEPT4 pillars of OOPS CONCEPT
4 pillars of OOPS CONCEPTAjay Chimmani
 
Oop concepts classes_objects
Oop concepts classes_objectsOop concepts classes_objects
Oop concepts classes_objectsWilliam Olivier
 
Object oriented programming concept
Object oriented programming conceptObject oriented programming concept
Object oriented programming conceptPina Parmar
 
Introduction to OOP concepts
Introduction to OOP conceptsIntroduction to OOP concepts
Introduction to OOP conceptsAhmed Farag
 
Oops concept in c++ unit 3 -topic 4
Oops concept in c++ unit 3 -topic 4Oops concept in c++ unit 3 -topic 4
Oops concept in c++ unit 3 -topic 4MOHIT TOMAR
 
Introduction to Prolog (PROramming in LOGic)
Introduction to Prolog (PROramming in LOGic)Introduction to Prolog (PROramming in LOGic)
Introduction to Prolog (PROramming in LOGic)Ahmed Gad
 
Object oriented programming concepts
Object oriented programming conceptsObject oriented programming concepts
Object oriented programming conceptsrahuld115
 
Friend function & friend class
Friend function & friend classFriend function & friend class
Friend function & friend classAbhishek Wadhwa
 
Java OOP Programming language (Part 6) - Abstract Class & Interface
Java OOP Programming language (Part 6) - Abstract Class & InterfaceJava OOP Programming language (Part 6) - Abstract Class & Interface
Java OOP Programming language (Part 6) - Abstract Class & InterfaceOUM SAOKOSAL
 
Inheritance, friend function, virtual function, polymorphism
Inheritance, friend function, virtual function, polymorphismInheritance, friend function, virtual function, polymorphism
Inheritance, friend function, virtual function, polymorphismJawad Khan
 

What's hot (20)

Oop in kotlin
Oop in kotlinOop in kotlin
Oop in kotlin
 
Object Oriented Concepts and Principles
Object Oriented Concepts and PrinciplesObject Oriented Concepts and Principles
Object Oriented Concepts and Principles
 
Object Oriented Programming using C++ Part II
Object Oriented Programming using C++ Part IIObject Oriented Programming using C++ Part II
Object Oriented Programming using C++ Part II
 
General OOP concept [by-Digvijay]
General OOP concept [by-Digvijay]General OOP concept [by-Digvijay]
General OOP concept [by-Digvijay]
 
4 pillars of OOPS CONCEPT
4 pillars of OOPS CONCEPT4 pillars of OOPS CONCEPT
4 pillars of OOPS CONCEPT
 
Oop concepts classes_objects
Oop concepts classes_objectsOop concepts classes_objects
Oop concepts classes_objects
 
Classes and Inheritance
Classes and InheritanceClasses and Inheritance
Classes and Inheritance
 
Object oriented programming concept
Object oriented programming conceptObject oriented programming concept
Object oriented programming concept
 
SEMINAR
SEMINARSEMINAR
SEMINAR
 
Introduction to OOP concepts
Introduction to OOP conceptsIntroduction to OOP concepts
Introduction to OOP concepts
 
Oops concept in c++ unit 3 -topic 4
Oops concept in c++ unit 3 -topic 4Oops concept in c++ unit 3 -topic 4
Oops concept in c++ unit 3 -topic 4
 
Introduction to Prolog (PROramming in LOGic)
Introduction to Prolog (PROramming in LOGic)Introduction to Prolog (PROramming in LOGic)
Introduction to Prolog (PROramming in LOGic)
 
Object oriented programming concepts
Object oriented programming conceptsObject oriented programming concepts
Object oriented programming concepts
 
Polymorphism in java
Polymorphism in javaPolymorphism in java
Polymorphism in java
 
Concept of Object Oriented Programming
Concept of Object Oriented Programming Concept of Object Oriented Programming
Concept of Object Oriented Programming
 
Friend function & friend class
Friend function & friend classFriend function & friend class
Friend function & friend class
 
Oop concept
Oop conceptOop concept
Oop concept
 
What is OOP?
What is OOP?What is OOP?
What is OOP?
 
Java OOP Programming language (Part 6) - Abstract Class & Interface
Java OOP Programming language (Part 6) - Abstract Class & InterfaceJava OOP Programming language (Part 6) - Abstract Class & Interface
Java OOP Programming language (Part 6) - Abstract Class & Interface
 
Inheritance, friend function, virtual function, polymorphism
Inheritance, friend function, virtual function, polymorphismInheritance, friend function, virtual function, polymorphism
Inheritance, friend function, virtual function, polymorphism
 

Similar to Object Oriented Programming Concepts

object oriented programing lecture 1
object oriented programing lecture 1object oriented programing lecture 1
object oriented programing lecture 1Geophery sanga
 
Object oriented programming in python
Object oriented programming in pythonObject oriented programming in python
Object oriented programming in pythonnitamhaske
 
Java căn bản - Chapter13
Java căn bản - Chapter13Java căn bản - Chapter13
Java căn bản - Chapter13Vince Vo
 
Chapter 13 - Inheritance and Polymorphism
Chapter 13 - Inheritance and PolymorphismChapter 13 - Inheritance and Polymorphism
Chapter 13 - Inheritance and PolymorphismEduardo Bergavera
 
Regex,functions, inheritance,class, attribute,overloding
Regex,functions, inheritance,class, attribute,overlodingRegex,functions, inheritance,class, attribute,overloding
Regex,functions, inheritance,class, attribute,overlodingsangumanikesh
 
Ch.1 oop introduction, classes and objects
Ch.1 oop introduction, classes and objectsCh.1 oop introduction, classes and objects
Ch.1 oop introduction, classes and objectsITNet
 
OOP lesson1 and Variables.pdf
OOP lesson1 and Variables.pdfOOP lesson1 and Variables.pdf
OOP lesson1 and Variables.pdfHouseMusica
 
Jedi slides 2.1 object-oriented concepts
Jedi slides 2.1 object-oriented conceptsJedi slides 2.1 object-oriented concepts
Jedi slides 2.1 object-oriented conceptsMaryo Manjaruni
 
PHP OOP Lecture - 01.pptx
PHP OOP Lecture - 01.pptxPHP OOP Lecture - 01.pptx
PHP OOP Lecture - 01.pptxAtikur Rahman
 
C++ programming introduction
C++ programming introductionC++ programming introduction
C++ programming introductionsandeep54552
 

Similar to Object Oriented Programming Concepts (20)

OBJECT ORIENTED PROGRAMMING CONCEPTS IN C++.pptx
OBJECT ORIENTED PROGRAMMING CONCEPTS IN C++.pptxOBJECT ORIENTED PROGRAMMING CONCEPTS IN C++.pptx
OBJECT ORIENTED PROGRAMMING CONCEPTS IN C++.pptx
 
Lecture 01 - Basic Concept About OOP With Python
Lecture 01 - Basic Concept About OOP With PythonLecture 01 - Basic Concept About OOP With Python
Lecture 01 - Basic Concept About OOP With Python
 
object oriented programing lecture 1
object oriented programing lecture 1object oriented programing lecture 1
object oriented programing lecture 1
 
Object oriented programming in python
Object oriented programming in pythonObject oriented programming in python
Object oriented programming in python
 
Seminar
SeminarSeminar
Seminar
 
oopusingc.pptx
oopusingc.pptxoopusingc.pptx
oopusingc.pptx
 
Java căn bản - Chapter13
Java căn bản - Chapter13Java căn bản - Chapter13
Java căn bản - Chapter13
 
Chapter 13 - Inheritance and Polymorphism
Chapter 13 - Inheritance and PolymorphismChapter 13 - Inheritance and Polymorphism
Chapter 13 - Inheritance and Polymorphism
 
Regex,functions, inheritance,class, attribute,overloding
Regex,functions, inheritance,class, attribute,overlodingRegex,functions, inheritance,class, attribute,overloding
Regex,functions, inheritance,class, attribute,overloding
 
Ch.1 oop introduction, classes and objects
Ch.1 oop introduction, classes and objectsCh.1 oop introduction, classes and objects
Ch.1 oop introduction, classes and objects
 
OOP lesson1 and Variables.pdf
OOP lesson1 and Variables.pdfOOP lesson1 and Variables.pdf
OOP lesson1 and Variables.pdf
 
oopm 2.pdf
oopm 2.pdfoopm 2.pdf
oopm 2.pdf
 
Lecture 5.pptx
Lecture 5.pptxLecture 5.pptx
Lecture 5.pptx
 
Oop ppt
Oop pptOop ppt
Oop ppt
 
Jedi slides 2.1 object-oriented concepts
Jedi slides 2.1 object-oriented conceptsJedi slides 2.1 object-oriented concepts
Jedi slides 2.1 object-oriented concepts
 
OOP in java
OOP in javaOOP in java
OOP in java
 
PHP OOP Lecture - 01.pptx
PHP OOP Lecture - 01.pptxPHP OOP Lecture - 01.pptx
PHP OOP Lecture - 01.pptx
 
JAVA-PPT'S.pdf
JAVA-PPT'S.pdfJAVA-PPT'S.pdf
JAVA-PPT'S.pdf
 
java - oop's in depth journey
java - oop's in depth journeyjava - oop's in depth journey
java - oop's in depth journey
 
C++ programming introduction
C++ programming introductionC++ programming introduction
C++ programming introduction
 

Recently uploaded

Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataBradBedford3
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfPower Karaoke
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEEVICTOR MAESTRE RAMIREZ
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackVICTOR MAESTRE RAMIREZ
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio, Inc.
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样umasea
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureDinusha Kumarasiri
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityNeo4j
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaHanief Utama
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWave PLM
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptkotipi9215
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based projectAnoyGreter
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxTier1 app
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfAlina Yurenko
 

Recently uploaded (20)

Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer DataAdobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
Adobe Marketo Engage Deep Dives: Using Webhooks to Transfer Data
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
The Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdfThe Evolution of Karaoke From Analog to App.pdf
The Evolution of Karaoke From Analog to App.pdf
 
Cloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEECloud Data Center Network Construction - IEEE
Cloud Data Center Network Construction - IEEE
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
Cloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStackCloud Management Software Platforms: OpenStack
Cloud Management Software Platforms: OpenStack
 
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed DataAlluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
Alluxio Monthly Webinar | Cloud-Native Model Training on Distributed Data
 
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
办理学位证(UQ文凭证书)昆士兰大学毕业证成绩单原版一模一样
 
Implementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with AzureImplementing Zero Trust strategy with Azure
Implementing Zero Trust strategy with Azure
 
EY_Graph Database Powered Sustainability
EY_Graph Database Powered SustainabilityEY_Graph Database Powered Sustainability
EY_Graph Database Powered Sustainability
 
React Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief UtamaReact Server Component in Next.js by Hanief Utama
React Server Component in Next.js by Hanief Utama
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
What is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need ItWhat is Fashion PLM and Why Do You Need It
What is Fashion PLM and Why Do You Need It
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
chapter--4-software-project-planning.ppt
chapter--4-software-project-planning.pptchapter--4-software-project-planning.ppt
chapter--4-software-project-planning.ppt
 
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort ServiceHot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
Hot Sexy call girls in Patel Nagar🔝 9953056974 🔝 escort Service
 
MYjobs Presentation Django-based project
MYjobs Presentation Django-based projectMYjobs Presentation Django-based project
MYjobs Presentation Django-based project
 
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptxKnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
KnowAPIs-UnknownPerf-jaxMainz-2024 (1).pptx
 
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdfGOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
GOING AOT WITH GRAALVM – DEVOXX GREECE.pdf
 

Object Oriented Programming Concepts

  • 2. TABLE OF CONTENTS 1. Introduction to OOPS 2. Characteristics of OOPS : Objects Classes Polymorphism Overloading Overriding Abstraction Data Encapsulation Inheritance Creation of Objects 1. Calling objects using Methods 2. Difference between OOPs and Procedure Based Programming
  • 3. WHY OOPS? ● OOP was introduced to overcome flaws in the procedural approach to programming ● Such as lack of reusability and maintainability Machine Language Assembly Language Structured Programming Language Procedural Programming Language Object Oriented Programming
  • 4. WHAT IS OOPS? ● Object oriented programming (OOP) is a programming technique in which programs are written on the basis of objects ● In OOP, problem is divided into number of entities called objects and then builds data and functions around these objects ● Data of objects can be accessed only by the functions associated with the objects ● Communication between objects is done through functions ● Follows bottom-up approach in program design
  • 5. OBJECTS ● Object is the basic unit of object oriented programming.Objects are identified by its unique name. ● An object represents a particular instance of a class.They may represent a person,a place or any item that the program must handle ● An object is a collection of data members and associated member functions also known as methods.
  • 6. CLASSES ● Classes are data types based on which objects are created. ● Thus a class represents a set of individual objects. ● Objects are variables of class. ● A class is a collection of objects of similar type. ● Example: Student ram, sham; ● In example ram and sham are name of objects fo class Student,We can create any number of objects for class
  • 7. CHARACTERISTICS:POLYMORPHISM ● Polymorphism is derived from 2 greek words: poly and morphs. The word "poly" means many and "morphs" means forms. So polymorphism means many forms. ● Polymorphism is an object-oriented programming concept that refers to the ability of a variable,function or object to take on multiple forms. ● 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.
  • 8. Compile time polymorphism: It is also known as static polymorphism. This type of polymorphism is achieved by function overloading or operator overloading. Runtime polymorphism: It is also known as Dynamic Method Dispatch. It is a process in which a function call to the overridden method is resolved at Runtime. This type of polymorphism is achieved by Method Overriding.
  • 9. OVERLOADING ● When there are multiple functions with same name but different parameters then these functions are said to be overloaded. Functions can be overloaded by change in number of arguments or/and change in type of arguments. ● Example: 1)By using different types of arguments ● 2) We can make the operator (‘+’) for string class to concatenate two strings. We know that this is the addition operator whose task is to add two operands. So a single operator ‘+’ when placed between integer operands, adds them and when placed between string operands, concatenates them.
  • 10. OVERRIDING ● Method overriding, occurs when a derived class has a definition for one of the member functions of the base class. That base function is said to be overridden. ● You can have a method in subclass overrides the method in its super classes with the same name and signature.
  • 11. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur eleifend a diam quis suscipit. Fusce venenatis nunc ut lectus convallis, sit amet egestas mi rutrum. Maecenas molestie ultricies euismod. Morbi a rutrum nisl. Vestibulum laoreet enim id sem fermentum, sed aliquam arcu dictum. Donec ultrices diam sagittis nibh pellentesque eleifend. CHARACTERISTICS:ABSTRACTION ● Providing only essential information about the data to the outside world, hiding the background details or implementation. ● Need to know: ○ Methods of the object are available ○ Input parameters needed ● Need not know: ○ How the method is implemented? ○ Which kinds of actions it has to perform? ● Example:The man only knows applying brakes will stop the car but he does not know about the inner mechanism of the car.
  • 12. CHARACTERISTICS:ENCAPSULATION Lorem Ipsum ● Binds together the data and functions that manipulate the data. ● Hide the internal representation, or state, of an object from the outside. This is called information hiding. ● Example: Calculator ○ Press 2+2 then see the result on display. ○ Don't have to know how it works inside. ● Advantages ○ Control over the data ○ Data hiding
  • 14. CHARACTERISTICS:INHERITANCE ● Mechanism in which one object acquires all the properties and behaviors of a parent object. ● The “extends” keyword indicates that you are making a new class that derives from an existing class. ● Why use it: ○ For Method Overriding ○ For Code Reusability class Animal{ void eat(){System.out.println("eating...");} } class Dog extends Animal{ void bark() {System.out.println("barking...");} } class TestInheritance{ public static void main(String args[]){ Dog d=new Dog(); d.bark(); d.eat(); }}
  • 15. CREATION OF OBJECTS How to Declare, Create and Initialize an Object in Java A class is a blueprint for Object, you can create an object from a class. Let's take Student class and try to create Java object for it. Let's create a simple Student class which has name and college fields. Let's write a program to create declare, create and initialize a Student object in Java.
  • 16. public class Student { private String name; private String college; public Student(String n, String c) { name = n; college = c; } public static void main(String[] args) { Student student = new Student("Ramesh", "BVB"); Student student2 = new Student("Prakash", "GEC"); Student student3 = new Student("Pramod", "IIT");} } Simple Program Demonstrating The Creation Of Objects Using ‘New’ Keyword
  • 17. From the above program, the Student objects are: Student student = new Student("Ramesh", "BVB"); Student student2 = new Student("Prakash", "GEC"); Student student3 = new Student("Pramod", "IIT"); Each of these statements has three parts: Declaration: The code Student student; declarations that associate a variable name with an object type. Instantiation: The new keyword is a Java operator that creates the object. Initialization: The new operator is followed by a call to a constructor, which initializes the new object.
  • 18. CALLING OBJECTS USING METHODS Now, we have the complete program below which creates three Student objects and invokes the printDetails() method on each of these objects. public class StudentTest { public void printdetails(String name,String college) { System.out.println(“Name of student is: “+ name + “n”); System.out.println(“Name of college student is studying in: “+ college + “n”); } public static void main ( String[] args ) { Student s1 = new Student (“Ramesh”,”BVB”) ; Student s2 = new Student ( "Prakash", “GEC” ); Student s3 = new Student ( "Pramod" , “IIT”); System.out.println("Student s1:n "); s1.printDetails(); System.out.println("nStudent s2: "); s2.printDetails(); System.out.println("nStudent s3: "); s3.printDetails(); }
  • 19. When we run this program, we get the following output: Student s1: Name of student is: Ramesh Name of college student is studying in is: BVB Student s2: Name of student is: Prakash Name of college student is studying in is: GEC Student s3: Name of student is: Pramod Name of college student is studying in is: IIT
  • 20. Now that we have created the objects, we will look into how the variables and methods of these objects can be accessed. In order to access a variable or a method, we use the reference/dot operator (.) in the following way: s1.printDetails(); The above statement invokes the printDetails() method on the Student object s1. If the method requires arguments, we state them within the parentheses. Variables too are accessed in a similar way, except that the parentheses are not included. This is what separates the variables from methods and helps us to distinguish between the two. If the name variable was public we could have used the following statement to assign a String to the name variables of s1 in the following way: s1.name="Ram"; We can also print these values, as we would have printed a String variable if the variable was declared as public. System.out.println("Name is "+ s1.name); But, for the current objects such access is denied since the variables were declared to be private which means that the variables are not accessible outside the class.
  • 21. DIFFERENCE BETWEEN OBJECT ORIENTED PROGRAMMING AND PROCEDURAL PROGRAMMING Object Based Programming Procedure-Based Programming Focuses on data Focuses on doing things(functions) Follows bottom-up approach Follows top-down approach Data abstraction and data hiding feature prevents accidental change in data Use of global variables puts the data at risk Extending the program is easier than procedure-based programming Extending the program is a difficult task

Editor's Notes

  1. Please do change the order of table of contents based on the order of presenting