SlideShare a Scribd company logo
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 OBJECT ORIENTED PROGRAMMING CONCEPTS IN C++.pptx (20)

PPTX
Need of object oriented programming
Amar Jukuntla
 
PPTX
Object Oriented Programming Concepts
SanmatiRM
 
PPTX
POP vs OOP Introduction
Hashni T
 
PDF
L1-Introduction to OOPs concepts.pdf
BhanuJatinSingh
 
PPTX
introduction of Object oriented programming
RiturajJain8
 
PPTX
Oops concepts
Kanan Gandhi
 
PDF
UNIT1- OBJECT ORIENTED PROGRAMMING IN JAVA- AIML IT-SPPU
ApurvaLaddha
 
PPT
Java Fundamentalojhgghjjjjhhgghhjjjjhhj.ppt
akashsachu221
 
PPTX
CPP-Unit 1.pptx
YashKoli22
 
PPTX
Object oriented programming 6 oop with c++
Vaibhav Khanna
 
PPTX
chapterOne.pptxFSdgfqdzwwfagxgghvkjljhcxCZZXvcbx
berihun18
 
DOC
Questpond - Top 10 Interview Questions and Answers on OOPS
gdrealspace
 
PPTX
Object oriented programming
baabtra.com - No. 1 supplier of quality freshers
 
PPTX
Characteristics-and-Advantages-of-Object-Oriented-Programming.pptx
mahendrasubedi2060
 
PPT
Basic concept of OOP's
Prof. Dr. K. Adisesha
 
PDF
Oops concepts || Object Oriented Programming Concepts in Java
Madishetty Prathibha
 
PPTX
Basics of object oriented programming c++ [autosaved]
RAVIPUROHIT22
 
PPTX
Object Oriented Programming Concepts Using C++
Mtnc BCA DEPARTMENT
 
PPTX
yo.pptxoajsdisa odasjd asodjaojdoawjdoasjdow
l226207
 
DOC
Introduction to OOPs Concept- Features, Basic concepts, Benefits and Applicat...
KrishnaveniT8
 
Need of object oriented programming
Amar Jukuntla
 
Object Oriented Programming Concepts
SanmatiRM
 
POP vs OOP Introduction
Hashni T
 
L1-Introduction to OOPs concepts.pdf
BhanuJatinSingh
 
introduction of Object oriented programming
RiturajJain8
 
Oops concepts
Kanan Gandhi
 
UNIT1- OBJECT ORIENTED PROGRAMMING IN JAVA- AIML IT-SPPU
ApurvaLaddha
 
Java Fundamentalojhgghjjjjhhgghhjjjjhhj.ppt
akashsachu221
 
CPP-Unit 1.pptx
YashKoli22
 
Object oriented programming 6 oop with c++
Vaibhav Khanna
 
chapterOne.pptxFSdgfqdzwwfagxgghvkjljhcxCZZXvcbx
berihun18
 
Questpond - Top 10 Interview Questions and Answers on OOPS
gdrealspace
 
Characteristics-and-Advantages-of-Object-Oriented-Programming.pptx
mahendrasubedi2060
 
Basic concept of OOP's
Prof. Dr. K. Adisesha
 
Oops concepts || Object Oriented Programming Concepts in Java
Madishetty Prathibha
 
Basics of object oriented programming c++ [autosaved]
RAVIPUROHIT22
 
Object Oriented Programming Concepts Using C++
Mtnc BCA DEPARTMENT
 
yo.pptxoajsdisa odasjd asodjaojdoawjdoasjdow
l226207
 
Introduction to OOPs Concept- Features, Basic concepts, Benefits and Applicat...
KrishnaveniT8
 

Recently uploaded (20)

PDF
The-Ever-Evolving-World-of-Science (1).pdf/7TH CLASS CURIOSITY /1ST CHAPTER/B...
Sandeep Swamy
 
PDF
ARAL-Orientation_Morning-Session_Day-11.pdf
JoelVilloso1
 
PDF
The History of Phone Numbers in Stoke Newington by Billy Thomas
History of Stoke Newington
 
PDF
Dimensions of Societal Planning in Commonism
StefanMz
 
PPTX
How to Set Up Tags in Odoo 18 - Odoo Slides
Celine George
 
PDF
Reconstruct, Restore, Reimagine: New Perspectives on Stoke Newington’s Histor...
History of Stoke Newington
 
PDF
0725.WHITEPAPER-UNIQUEWAYSOFPROTOTYPINGANDUXNOW.pdf
Thomas GIRARD, MA, CDP
 
PDF
Stokey: A Jewish Village by Rachel Kolsky
History of Stoke Newington
 
PPTX
PATIENT ASSIGNMENTS AND NURSING CARE RESPONSIBILITIES.pptx
PRADEEP ABOTHU
 
PPTX
2025 Winter SWAYAM NPTEL & A Student.pptx
Utsav Yagnik
 
PPTX
How to Set Maximum Difference Odoo 18 POS
Celine George
 
PPTX
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
PPTX
How to Convert an Opportunity into a Quotation in Odoo 18 CRM
Celine George
 
PPTX
Neurodivergent Friendly Schools - Slides from training session
Pooky Knightsmith
 
PDF
LAW OF CONTRACT ( 5 YEAR LLB & UNITARY LLB)- MODULE-3 - LEARN THROUGH PICTURE
APARNA T SHAIL KUMAR
 
PPT
Talk on Critical Theory, Part II, Philosophy of Social Sciences
Soraj Hongladarom
 
PPTX
Universal immunization Programme (UIP).pptx
Vishal Chanalia
 
PPTX
How to Manage Large Scrollbar in Odoo 18 POS
Celine George
 
PDF
Isharyanti-2025-Cross Language Communication in Indonesian Language
Neny Isharyanti
 
PDF
The Constitution Review Committee (CRC) has released an updated schedule for ...
nservice241
 
The-Ever-Evolving-World-of-Science (1).pdf/7TH CLASS CURIOSITY /1ST CHAPTER/B...
Sandeep Swamy
 
ARAL-Orientation_Morning-Session_Day-11.pdf
JoelVilloso1
 
The History of Phone Numbers in Stoke Newington by Billy Thomas
History of Stoke Newington
 
Dimensions of Societal Planning in Commonism
StefanMz
 
How to Set Up Tags in Odoo 18 - Odoo Slides
Celine George
 
Reconstruct, Restore, Reimagine: New Perspectives on Stoke Newington’s Histor...
History of Stoke Newington
 
0725.WHITEPAPER-UNIQUEWAYSOFPROTOTYPINGANDUXNOW.pdf
Thomas GIRARD, MA, CDP
 
Stokey: A Jewish Village by Rachel Kolsky
History of Stoke Newington
 
PATIENT ASSIGNMENTS AND NURSING CARE RESPONSIBILITIES.pptx
PRADEEP ABOTHU
 
2025 Winter SWAYAM NPTEL & A Student.pptx
Utsav Yagnik
 
How to Set Maximum Difference Odoo 18 POS
Celine George
 
A PPT on Alfred Lord Tennyson's Ulysses.
Beena E S
 
How to Convert an Opportunity into a Quotation in Odoo 18 CRM
Celine George
 
Neurodivergent Friendly Schools - Slides from training session
Pooky Knightsmith
 
LAW OF CONTRACT ( 5 YEAR LLB & UNITARY LLB)- MODULE-3 - LEARN THROUGH PICTURE
APARNA T SHAIL KUMAR
 
Talk on Critical Theory, Part II, Philosophy of Social Sciences
Soraj Hongladarom
 
Universal immunization Programme (UIP).pptx
Vishal Chanalia
 
How to Manage Large Scrollbar in Odoo 18 POS
Celine George
 
Isharyanti-2025-Cross Language Communication in Indonesian Language
Neny Isharyanti
 
The Constitution Review Committee (CRC) has released an updated schedule for ...
nservice241
 
Ad

OBJECT ORIENTED PROGRAMMING CONCEPTS IN C++.pptx

  • 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.