SlideShare a Scribd company logo
1 of 15
OBJECT ORIENTED
PROGRAMMING CONCEPTS
UNIT 1
PREPARED BY
LOKESH SHARMA AND HARSH
SHARMA
PROCEDURAL LANGUAGE AND OBJECT
ORIENTED APPROACH
Procedural Oriented Programming Object-Oriented Programming
In procedural programming, the program is
divided into small parts called functions.
In object-oriented programming, the
program is divided into small parts
called objects.
There is no access specifier in procedural
programming.
Object-oriented programming has access
specifiers like private, public, protected,
etc.
Adding new data and functions is not easy. Adding new data and function is easy.
Procedural programming does not have any
proper way of hiding data so it is less secure.
Object-oriented programming provides
data hiding so it is more secure.
In procedural programming, overloading is
not possible.
Overloading is possible in object-oriented
programming.
In procedural programming, the function is
more important than the data.
In object-oriented programming, data is
more important than function.
Code reusability absent in procedural
programming,
Code reusability present in object-oriented
programming.
Examples: C, FORTRAN, Pascal, Basic, etc. Examples: C++, Java, Python, C#, etc.
CHARACTERSTICS OF OOPS
Object-oriented programming (OOP) has become one of the most popular
programming paradigms at the current time. Almost every major programming
language provides some form of OOP support, making it a very accessible option
for programmers of various levels and domains.
OBJECTS
In C++, Object is a real world entity, for example, chair, car, pen,
mobile, laptop etc.
In other words, object is an entity that has state and behavior. Here,
state means data and behavior means functionality.
Object is a runtime entity, it is created at runtime.
Student s1; //creating an object of Student
Let's see an example to create object of student class using s1 as the reference
variable.
In this example, Student is the type and s1 is the reference variable
that refers to the instance of Student class.
CLASSES
The next characteristic of object-oriented programming is the definition of classes.
A class is where the blueprint for an object is defined. The blueprint defines the
methods, attributes, and other aspects of the object. Objects are created from
classes. A class is also known as a blueprint for an object. It defines properties,
methods, and other aspects associated with the object. Objects are created from
classes. A class is essentially a blueprint for an object. It defines properties,
methods, and other aspects associated with the object.
ENCAPSULATION
Another characteristic of OOP is that it emphasizes the encapsulation of data and
functionality within objects. Objects are defined with specific functionality that
governs the interactions between the objects. Encapsulation of data is an
extremely important aspect of OOP. This is because it prevents hackers from
modifying data that is stored in the database
Abstraction
If you are a user, and you have a problem statement, you don't want to
know how the components of the software work, or how it's made. You only
want to know how the software solves your problem. Abstraction is the
method of hiding unnecessary details from the necessary ones. It is one of
the main features of OOPs. For example, consider a car. You only need to
know how to run a car, and not how the wires are connected inside it. This
is obtained using Abstraction
INHERITANCE
Inheritance means inheriting someone's characteristics. Just like you inherit
features and habits from your parents, it is possible to inherit the data and
methods from one class to another. Combining and inheriting the objects and
their properties is one of the most essential and important characteristics of
oops.
Super Class: The class from which the properties are inherited by the sub
class/child class.
Sub Class: The class which inherits the properties from the super
class/parent class.
Inheritance helps you do the separation of the same fields and functionality
so that it can be reused in other classes. And this helps in code redundancy.
Composition
Composition is the procedure of combining two or more objects together
to create a new and unique object. Through this process developers find it
easy to reuse the elements specifically needed for the object to create a
new and unique object
POLYMORPHISM
Polymorphism means to have the same name of a method performing different
tasks. For example, in finding out the area of the shape, the area of the square is
length2, and the area of the rectangle is length*breadth.
It has the ability to display the message in more than one form. A person can
possess different characteristics at the same time, so this is what polymorphism is
all about.
Polymorphism exhibits two different
behaviors
Static Polymorphism/ Method Overloading: It occurs when methods with the
same name have differences in the number and types of parameters.
For example:
Explanation:
Both Person and Child classes have the
same method, i.e., walks(), and the Child
class overrides the walks() method by
having its own implementation.
OUTPUT :-
Static Polymorphism/ Method Overloading: It
occurs when methods with the same name have differences in the number and
types of parameters.
Explanation:
In the above code, the show() method is
overloaded by changing the number of
parameters as well as by changing the name
of the data type. So this is known as Method
Overloading.
Polymorphism has the ability to perform
different tasks with the same method, due
to which the code is clean.
OUTPUT:-
Data Binding
Binding means to bind one thing to another one. Here in OOPS, binding refers to
linking some attribute of one object to another one in the Application.
There are two main types of binding:
Static Binding
Dynamic binding
Let's understand both of them using an example.
Static Binding
In static binding, the property of one object is changed directly without changing
the other property.
OUTPUT:-
Explanation
When any type of object
is determined at the
compile time, then it is
known as static binding.
Also, play() and walks()
are private methods, and
that is the reason for
the static binding.
Dynamic Binding
When any object is determined at the run time, then it is known as dynamic
binding.
Dynamic Binding occurs when the property of one object changes, and due to
this, the property of another object gets changed.
OUTPUT:-
Explanation
In the above code, the instance of Child
is also an instance of Person, So the
compiler can't determine the object
type.
MESSAGE PASSING
Passing data around the program is the most important feature of the oop concept.
Message passing is the sending of a message from one object to another. How does
this occur?
As we know that each object has its own specific address that other objects can use
to send messages. Now that object can do whatever it needs to do based on the
message. Multiple objects can communicate with each other in interesting ways.

More Related Content

Similar to OOP Concepts Explained

Similar to OOP Concepts Explained (20)

JAVA - Oops Concept.pptx
JAVA - Oops Concept.pptxJAVA - Oops Concept.pptx
JAVA - Oops Concept.pptx
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
 
Oops concepts
Oops conceptsOops concepts
Oops concepts
 
OOP
OOPOOP
OOP
 
OOP.pptx
OOP.pptxOOP.pptx
OOP.pptx
 
M.c.a. (sem iv)- java programming
M.c.a. (sem   iv)- java programmingM.c.a. (sem   iv)- java programming
M.c.a. (sem iv)- java programming
 
PHP OOP Lecture - 01.pptx
PHP OOP Lecture - 01.pptxPHP OOP Lecture - 01.pptx
PHP OOP Lecture - 01.pptx
 
Principles of OOPs.pptx
Principles of OOPs.pptxPrinciples of OOPs.pptx
Principles of OOPs.pptx
 
POP vs OOP Introduction
POP vs OOP IntroductionPOP vs OOP Introduction
POP vs OOP Introduction
 
Ooad notes
Ooad notesOoad notes
Ooad notes
 
OOPS_Unit_1
OOPS_Unit_1OOPS_Unit_1
OOPS_Unit_1
 
Java Progamming Paradigms, OOPS Concept, Introduction to Java, Structure of J...
Java Progamming Paradigms, OOPS Concept, Introduction to Java, Structure of J...Java Progamming Paradigms, OOPS Concept, Introduction to Java, Structure of J...
Java Progamming Paradigms, OOPS Concept, Introduction to Java, Structure of J...
 
Java Programming Paradigms Chapter 1
Java Programming Paradigms Chapter 1 Java Programming Paradigms Chapter 1
Java Programming Paradigms Chapter 1
 
Chapter1
Chapter1Chapter1
Chapter1
 
Chapter1 introduction
Chapter1 introductionChapter1 introduction
Chapter1 introduction
 
CS3391 -OOP -UNIT – I NOTES FINAL.pdf
CS3391 -OOP -UNIT – I  NOTES FINAL.pdfCS3391 -OOP -UNIT – I  NOTES FINAL.pdf
CS3391 -OOP -UNIT – I NOTES FINAL.pdf
 
Benefits of encapsulation
Benefits of encapsulationBenefits of encapsulation
Benefits of encapsulation
 
oopsinvb-191021101327.pdf
oopsinvb-191021101327.pdfoopsinvb-191021101327.pdf
oopsinvb-191021101327.pdf
 
Oops in vb
Oops in vbOops in vb
Oops in vb
 
Java pdf
Java   pdfJava   pdf
Java pdf
 

Recently uploaded

Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxAvyJaneVismanos
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceSamikshaHamane
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfMr Bounab Samir
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...jaredbarbolino94
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for BeginnersSabitha Banu
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxUnboundStockton
 

Recently uploaded (20)

Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
Final demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptxFinal demo Grade 9 for demo Plan dessert.pptx
Final demo Grade 9 for demo Plan dessert.pptx
 
Roles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in PharmacovigilanceRoles & Responsibilities in Pharmacovigilance
Roles & Responsibilities in Pharmacovigilance
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...OS-operating systems- ch04 (Threads) ...
OS-operating systems- ch04 (Threads) ...
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdfLike-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
Like-prefer-love -hate+verb+ing & silent letters & citizenship text.pdf
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Full Stack Web Development Course for Beginners
Full Stack Web Development Course  for BeginnersFull Stack Web Development Course  for Beginners
Full Stack Web Development Course for Beginners
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docx
 

OOP Concepts Explained

  • 1. OBJECT ORIENTED PROGRAMMING CONCEPTS UNIT 1 PREPARED BY LOKESH SHARMA AND HARSH SHARMA
  • 2. PROCEDURAL LANGUAGE AND OBJECT ORIENTED APPROACH Procedural Oriented Programming Object-Oriented Programming In procedural programming, the program is divided into small parts called functions. In object-oriented programming, the program is divided into small parts called objects. There is no access specifier in procedural programming. Object-oriented programming has access specifiers like private, public, protected, etc. Adding new data and functions is not easy. Adding new data and function is easy. Procedural programming does not have any proper way of hiding data so it is less secure. Object-oriented programming provides data hiding so it is more secure. In procedural programming, overloading is not possible. Overloading is possible in object-oriented programming. In procedural programming, the function is more important than the data. In object-oriented programming, data is more important than function. Code reusability absent in procedural programming, Code reusability present in object-oriented programming. Examples: C, FORTRAN, Pascal, Basic, etc. Examples: C++, Java, Python, C#, etc.
  • 3. CHARACTERSTICS OF OOPS Object-oriented programming (OOP) has become one of the most popular programming paradigms at the current time. Almost every major programming language provides some form of OOP support, making it a very accessible option for programmers of various levels and domains.
  • 4. OBJECTS In C++, Object is a real world entity, for example, chair, car, pen, mobile, laptop etc. In other words, object is an entity that has state and behavior. Here, state means data and behavior means functionality. Object is a runtime entity, it is created at runtime. Student s1; //creating an object of Student Let's see an example to create object of student class using s1 as the reference variable. In this example, Student is the type and s1 is the reference variable that refers to the instance of Student class.
  • 5. CLASSES The next characteristic of object-oriented programming is the definition of classes. A class is where the blueprint for an object is defined. The blueprint defines the methods, attributes, and other aspects of the object. Objects are created from classes. A class is also known as a blueprint for an object. It defines properties, methods, and other aspects associated with the object. Objects are created from classes. A class is essentially a blueprint for an object. It defines properties, methods, and other aspects associated with the object.
  • 6. ENCAPSULATION Another characteristic of OOP is that it emphasizes the encapsulation of data and functionality within objects. Objects are defined with specific functionality that governs the interactions between the objects. Encapsulation of data is an extremely important aspect of OOP. This is because it prevents hackers from modifying data that is stored in the database
  • 7. Abstraction If you are a user, and you have a problem statement, you don't want to know how the components of the software work, or how it's made. You only want to know how the software solves your problem. Abstraction is the method of hiding unnecessary details from the necessary ones. It is one of the main features of OOPs. For example, consider a car. You only need to know how to run a car, and not how the wires are connected inside it. This is obtained using Abstraction
  • 8. INHERITANCE Inheritance means inheriting someone's characteristics. Just like you inherit features and habits from your parents, it is possible to inherit the data and methods from one class to another. Combining and inheriting the objects and their properties is one of the most essential and important characteristics of oops. Super Class: The class from which the properties are inherited by the sub class/child class. Sub Class: The class which inherits the properties from the super class/parent class. Inheritance helps you do the separation of the same fields and functionality so that it can be reused in other classes. And this helps in code redundancy. Composition Composition is the procedure of combining two or more objects together to create a new and unique object. Through this process developers find it easy to reuse the elements specifically needed for the object to create a new and unique object
  • 9. POLYMORPHISM Polymorphism means to have the same name of a method performing different tasks. For example, in finding out the area of the shape, the area of the square is length2, and the area of the rectangle is length*breadth. It has the ability to display the message in more than one form. A person can possess different characteristics at the same time, so this is what polymorphism is all about.
  • 10. Polymorphism exhibits two different behaviors Static Polymorphism/ Method Overloading: It occurs when methods with the same name have differences in the number and types of parameters. For example: Explanation: Both Person and Child classes have the same method, i.e., walks(), and the Child class overrides the walks() method by having its own implementation. OUTPUT :-
  • 11. Static Polymorphism/ Method Overloading: It occurs when methods with the same name have differences in the number and types of parameters. Explanation: In the above code, the show() method is overloaded by changing the number of parameters as well as by changing the name of the data type. So this is known as Method Overloading. Polymorphism has the ability to perform different tasks with the same method, due to which the code is clean. OUTPUT:-
  • 12. Data Binding Binding means to bind one thing to another one. Here in OOPS, binding refers to linking some attribute of one object to another one in the Application. There are two main types of binding: Static Binding Dynamic binding Let's understand both of them using an example. Static Binding In static binding, the property of one object is changed directly without changing the other property.
  • 13. OUTPUT:- Explanation When any type of object is determined at the compile time, then it is known as static binding. Also, play() and walks() are private methods, and that is the reason for the static binding.
  • 14. Dynamic Binding When any object is determined at the run time, then it is known as dynamic binding. Dynamic Binding occurs when the property of one object changes, and due to this, the property of another object gets changed. OUTPUT:- Explanation In the above code, the instance of Child is also an instance of Person, So the compiler can't determine the object type.
  • 15. MESSAGE PASSING Passing data around the program is the most important feature of the oop concept. Message passing is the sending of a message from one object to another. How does this occur? As we know that each object has its own specific address that other objects can use to send messages. Now that object can do whatever it needs to do based on the message. Multiple objects can communicate with each other in interesting ways.