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

PDF
Procedural-vs-Object-Oriented-Programming (1).pdf
PDF
object oriented programming concepts and explanation
PPTX
Object oriented programming (oops) python
PPTX
OOPs Java Module 1.pptx marketing trends social media company profilesmarketi...
PPTX
Chapter 04 object oriented programming
PPTX
SKILLWISE - OOPS CONCEPT
PPTX
object oriented programming and methodology.pptx
DOC
Chapter1
Procedural-vs-Object-Oriented-Programming (1).pdf
object oriented programming concepts and explanation
Object oriented programming (oops) python
OOPs Java Module 1.pptx marketing trends social media company profilesmarketi...
Chapter 04 object oriented programming
SKILLWISE - OOPS CONCEPT
object oriented programming and methodology.pptx
Chapter1

Similar to OBJECT ORIENTED PROGRAMMING CONCEPTS IN C++.pptx (20)

PPTX
Block_1_Unit- I.pdf bca learning for exam you
PPTX
Need of object oriented programming
PPTX
Object Oriented Programming Concepts
PPTX
POP vs OOP Introduction
PDF
L1-Introduction to OOPs concepts.pdf
PPTX
introduction of Object oriented programming
PPTX
Oops concepts
PDF
UNIT1- OBJECT ORIENTED PROGRAMMING IN JAVA- AIML IT-SPPU
PPT
Java Fundamentalojhgghjjjjhhgghhjjjjhhj.ppt
PPTX
CPP-Unit 1.pptx
PPTX
Object oriented programming 6 oop with c++
PPTX
Intro to object oriented programming.pptx
PPTX
chapterOne.pptxFSdgfqdzwwfagxgghvkjljhcxCZZXvcbx
DOC
Questpond - Top 10 Interview Questions and Answers on OOPS
PPTX
PPTX
Characteristics-and-Advantages-of-Object-Oriented-Programming.pptx
PPT
Basic concept of OOP's
PDF
Oops concepts || Object Oriented Programming Concepts in Java
PPTX
Basics of object oriented programming c++ [autosaved]
PPTX
Object Oriented Programming Concepts Using C++
Block_1_Unit- I.pdf bca learning for exam you
Need of object oriented programming
Object Oriented Programming Concepts
POP vs OOP Introduction
L1-Introduction to OOPs concepts.pdf
introduction of Object oriented programming
Oops concepts
UNIT1- OBJECT ORIENTED PROGRAMMING IN JAVA- AIML IT-SPPU
Java Fundamentalojhgghjjjjhhgghhjjjjhhj.ppt
CPP-Unit 1.pptx
Object oriented programming 6 oop with c++
Intro to object oriented programming.pptx
chapterOne.pptxFSdgfqdzwwfagxgghvkjljhcxCZZXvcbx
Questpond - Top 10 Interview Questions and Answers on OOPS
Characteristics-and-Advantages-of-Object-Oriented-Programming.pptx
Basic concept of OOP's
Oops concepts || Object Oriented Programming Concepts in Java
Basics of object oriented programming c++ [autosaved]
Object Oriented Programming Concepts Using C++
Ad

Recently uploaded (20)

PDF
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
PPTX
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
PDF
2.FourierTransform-ShortQuestionswithAnswers.pdf
PDF
Classroom Observation Tools for Teachers
PPTX
Week 4 Term 3 Study Techniques revisited.pptx
PDF
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
PDF
RMMM.pdf make it easy to upload and study
PDF
VCE English Exam - Section C Student Revision Booklet
PPTX
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
PPTX
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
PDF
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
PPTX
Microbial diseases, their pathogenesis and prophylaxis
PPTX
Renaissance Architecture: A Journey from Faith to Humanism
PPTX
Pharmacology of Heart Failure /Pharmacotherapy of CHF
PDF
Pre independence Education in Inndia.pdf
PDF
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
PDF
O7-L3 Supply Chain Operations - ICLT Program
PDF
Supply Chain Operations Speaking Notes -ICLT Program
PPTX
Institutional Correction lecture only . . .
PPTX
Pharma ospi slides which help in ospi learning
Mark Klimek Lecture Notes_240423 revision books _173037.pdf
PPT- ENG7_QUARTER1_LESSON1_WEEK1. IMAGERY -DESCRIPTIONS pptx.pptx
2.FourierTransform-ShortQuestionswithAnswers.pdf
Classroom Observation Tools for Teachers
Week 4 Term 3 Study Techniques revisited.pptx
BÀI TẬP BỔ TRỢ 4 KỸ NĂNG TIẾNG ANH 9 GLOBAL SUCCESS - CẢ NĂM - BÁM SÁT FORM Đ...
RMMM.pdf make it easy to upload and study
VCE English Exam - Section C Student Revision Booklet
BOWEL ELIMINATION FACTORS AFFECTING AND TYPES
school management -TNTEU- B.Ed., Semester II Unit 1.pptx
Physiotherapy_for_Respiratory_and_Cardiac_Problems WEBBER.pdf
Microbial diseases, their pathogenesis and prophylaxis
Renaissance Architecture: A Journey from Faith to Humanism
Pharmacology of Heart Failure /Pharmacotherapy of CHF
Pre independence Education in Inndia.pdf
3rd Neelam Sanjeevareddy Memorial Lecture.pdf
O7-L3 Supply Chain Operations - ICLT Program
Supply Chain Operations Speaking Notes -ICLT Program
Institutional Correction lecture only . . .
Pharma ospi slides which help in ospi learning
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.