SlideShare a Scribd company logo
Introduction to C++….
Procedure oriented programming:
A typical program that consists of a list of instructions to
accomplish a task.
Larger programs are divided into a number of functions, where
each function has a well defined purpose.
Global data is accessible to all the functions it is difficult to find
out which data is being used by which function. Changes made can
affect in any manner.
Global Variables
Local Variables
Function A
Local Variables
Function B
Some important features of a procedure oriented programming
language:
1. Emphasis is laid on algorithm.
2. Complex programs are divided into functions.
3. Generally functions share important data.
4. Data is passed from function to function.
5. Top down approach is used in program design.
Drawback is that complexity increases as program grows larger.
Object Oriented Programming:
OOP does not allow data to move freely between the functions.
It binds the data to the function that operate on it and protects it
from being modified accidentally by outside functions.
The object oriented approach is to combine both data and the
functions that operate on that data, into a single unit called an
object.
Object 1
Object 2 Object 3
Member Functions
Data
Member Functions
Data
Member Functions
Data
Features of object oriented programming language:
1. Emphasis is laid on data.
2. Programs are divided into objects.
3. Objects contain the data and the functions that operate on the
data.
4. Data is hidden and cannot be accessed by outside functions.
5. Objects are allowed to communicate with each other through
functions.
6. Bottom Up approach is used in program design.
Drawback is that complexity increases as program grows larger.
Basic concepts used in object oriented programming:
1. Object 2. Class 3. Data Abstraction 4. Data Encapsulation
5. Inheritance 6. Reusability 7. Polymorphism 8. Dynamic binding
9. Message communication
1. Objects: Objects are entities that exhibit both state and behavior.
Objects are basic runtime entities.
Each object consists of data and code to manipulate the data.
Employee
Object: Employee
Data: Name, basic_pay
Functions: Read_data,
Net_pay, Display
Employee data
--------------------
Read_data
Net_pay
Display
Basic features of an object:
1. Objects are basic runtime entities. The word instance is a
synonym for object.
2. They represent a person, place or any data items that the
program has to handle.
3. They occupy space in memory with an associated address.
4. Objects communicate with each other by sending messages to
one another.
2. Class: A class is a collection of similar type of objects.
Object is an instance of a class.
A class is created with data members and the member functions.
Ex: Consider a class called shape, objects of this class would be
circle, rectangle, triangle etc.
object is created in this manner:
class name object name;
ex: shape ob1; Here shape is class and ob1 is object.
3. Data Abstraction: Data abstraction helps in binding data and
the functions together. The process of representing the essential
features without the background details is called abstraction.
4. Data Encapsulation: It binds both data and functions into a
class and keeps them safe from outside functions and misuse.
The data is accessible only through the functions, otherwise it
remains hidden from users.
This insulation of data from direct access by the program is called
data hiding or information hiding.
5. Inheritance: It is a process by which an object inherits the
properties of another object belonging to another class.
Ex: ‘mango’ is part of the class fruit which again is part of the
larger class food.
The original class is known as base class and the new class is
referred to as derived class or sub class.
6. Reusability: Once a class is created and tested and read to use,
it can be distributed to other programmers for using in their
programs, this is known as reusability.
Inheritance supports the idea of reusability, where the
programmers can add new features without modifying the existing
class.
7. Polymorphism: The ability to take more than one form is called
polymorphism.
Ex: All brands of air conditioners do the same work, cooling the
temperature.
Ex: Addition operator + is used to add two values and even it is
used to concatenate two strings.
This process of an operator acquiring different behavior in
different instances is known as operator overloading.
8. Dynamic binding:
Binding refers to the process of resolving the function to be
associated with the function call. There are two types…
1. Static binding: Binding takes place during compilation. It is also
known as early binding.
2. Dynamic binding: It is also called as late binding, coz the code
associated with a given function call is not known until run-time.
9. Message communication: A message is nothing but execution
of a procedure.
Message communication involves specifying the name of the
object, name of the function and the information to be sent.
For Ex: consider a class called stack.
stack1.push(1); here stack1 is object, push is a function
and 1 is information.
Applications of OOP
1. Real-time systems.
2. Object oriented database.
3. Artificial intelligence and expert systems.
4. Simulation and modeling.
5. Neural networks.
6. Office automation systems.
Difference between POP and OOP
Procedure Oriented Object oriented
Focus is on functions Focus is on data
Data is not secured Data is secure.
Uses top down programming
design
Uses bottom up programming
design
Does not model real world
problem
Models real world problems
Programs are divided into
functions
Programs are divided into
objects

More Related Content

Similar to Ch 1 Introduction to Object Oriented Programming.pptx

Object Oriented Programming Lecture Notes
Object Oriented Programming Lecture NotesObject Oriented Programming Lecture Notes
Object Oriented Programming Lecture Notes
FellowBuddy.com
 
Chapter1 introduction
Chapter1 introductionChapter1 introduction
Chapter1 introduction
Jeevan Acharya
 
DOC-20210303-WA0017..pptx,coding stuff in c
DOC-20210303-WA0017..pptx,coding stuff in cDOC-20210303-WA0017..pptx,coding stuff in c
DOC-20210303-WA0017..pptx,coding stuff in c
floraaluoch3
 
Object Oriented Language
Object Oriented LanguageObject Oriented Language
Object Oriented Language
dheva B
 
INTRODUCTION TO JAVA
INTRODUCTION TO JAVAINTRODUCTION TO JAVA
INTRODUCTION TO JAVA
RAMALINGHAM KRISHNAMOORTHY
 
chapter - 1.ppt
chapter - 1.pptchapter - 1.ppt
chapter - 1.ppt
SakthiVinoth78
 
Unit 1 OOSE
Unit 1 OOSE Unit 1 OOSE
Unit 1 OOSE
ChhayaShelake
 
The smartpath information systems c plus plus
The smartpath information systems  c plus plusThe smartpath information systems  c plus plus
The smartpath information systems c plus plus
The Smartpath Information Systems,Bhilai,Durg,Chhattisgarh.
 
Object Oriented Programming using C++.pptx
Object Oriented Programming using C++.pptxObject Oriented Programming using C++.pptx
Object Oriented Programming using C++.pptx
parveen837153
 
C++ & VISUAL C++
C++ & VISUAL C++ C++ & VISUAL C++
C++ & VISUAL C++
Makaha Rutendo
 
OOP.pptx
OOP.pptxOOP.pptx
OOP.pptx
kalyanibedekar
 
My c++
My c++My c++
My c++
snathick
 
OOP ppt.pdf
OOP ppt.pdfOOP ppt.pdf
OOP ppt.pdf
ArpitaJana28
 
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
Praveen Chowdary
 
A Hand Book of Visual Basic 6.0.pdf.pdf
A Hand Book of Visual Basic 6.0.pdf.pdfA Hand Book of Visual Basic 6.0.pdf.pdf
A Hand Book of Visual Basic 6.0.pdf.pdf
Ann Wera
 
1 intro
1 intro1 intro
1 intro
abha48
 
Bca 2nd sem u-1 iintroduction
Bca 2nd sem u-1 iintroductionBca 2nd sem u-1 iintroduction
Bca 2nd sem u-1 iintroduction
Rai University
 
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...
Sakthi Durai
 
Java Programming Paradigms Chapter 1
Java Programming Paradigms Chapter 1 Java Programming Paradigms Chapter 1
Java Programming Paradigms Chapter 1
Sakthi Durai
 
Ooad notes
Ooad notesOoad notes
Ooad notes
NancyJP
 

Similar to Ch 1 Introduction to Object Oriented Programming.pptx (20)

Object Oriented Programming Lecture Notes
Object Oriented Programming Lecture NotesObject Oriented Programming Lecture Notes
Object Oriented Programming Lecture Notes
 
Chapter1 introduction
Chapter1 introductionChapter1 introduction
Chapter1 introduction
 
DOC-20210303-WA0017..pptx,coding stuff in c
DOC-20210303-WA0017..pptx,coding stuff in cDOC-20210303-WA0017..pptx,coding stuff in c
DOC-20210303-WA0017..pptx,coding stuff in c
 
Object Oriented Language
Object Oriented LanguageObject Oriented Language
Object Oriented Language
 
INTRODUCTION TO JAVA
INTRODUCTION TO JAVAINTRODUCTION TO JAVA
INTRODUCTION TO JAVA
 
chapter - 1.ppt
chapter - 1.pptchapter - 1.ppt
chapter - 1.ppt
 
Unit 1 OOSE
Unit 1 OOSE Unit 1 OOSE
Unit 1 OOSE
 
The smartpath information systems c plus plus
The smartpath information systems  c plus plusThe smartpath information systems  c plus plus
The smartpath information systems c plus plus
 
Object Oriented Programming using C++.pptx
Object Oriented Programming using C++.pptxObject Oriented Programming using C++.pptx
Object Oriented Programming using C++.pptx
 
C++ & VISUAL C++
C++ & VISUAL C++ C++ & VISUAL C++
C++ & VISUAL C++
 
OOP.pptx
OOP.pptxOOP.pptx
OOP.pptx
 
My c++
My c++My c++
My c++
 
OOP ppt.pdf
OOP ppt.pdfOOP ppt.pdf
OOP ppt.pdf
 
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
 
A Hand Book of Visual Basic 6.0.pdf.pdf
A Hand Book of Visual Basic 6.0.pdf.pdfA Hand Book of Visual Basic 6.0.pdf.pdf
A Hand Book of Visual Basic 6.0.pdf.pdf
 
1 intro
1 intro1 intro
1 intro
 
Bca 2nd sem u-1 iintroduction
Bca 2nd sem u-1 iintroductionBca 2nd sem u-1 iintroduction
Bca 2nd sem u-1 iintroduction
 
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
 
Ooad notes
Ooad notesOoad notes
Ooad notes
 

Recently uploaded

What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
GeorgeMilliken2
 
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
Leena Ghag-Sakpal
 
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skillsspot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
haiqairshad
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
History of Stoke Newington
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
Nguyen Thanh Tu Collection
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
mulvey2
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
Colégio Santa Teresinha
 
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptxChapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Denish Jangid
 
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
Himanshu Rai
 
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptxNEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
iammrhaywood
 
How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience
Wahiba Chair Training & Consulting
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
Nguyen Thanh Tu Collection
 
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching AptitudeUGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
S. Raj Kumar
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
Dr. Mulla Adam Ali
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
adhitya5119
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
PECB
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
Priyankaranawat4
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
Celine George
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Excellence Foundation for South Sudan
 
How to deliver Powerpoint Presentations.pptx
How to deliver Powerpoint  Presentations.pptxHow to deliver Powerpoint  Presentations.pptx
How to deliver Powerpoint Presentations.pptx
HajraNaeem15
 

Recently uploaded (20)

What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
What is Digital Literacy? A guest blog from Andy McLaughlin, University of Ab...
 
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
Bed Making ( Introduction, Purpose, Types, Articles, Scientific principles, N...
 
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skillsspot a liar (Haiqa 146).pptx Technical writhing and presentation skills
spot a liar (Haiqa 146).pptx Technical writhing and presentation skills
 
The History of Stoke Newington Street Names
The History of Stoke Newington Street NamesThe History of Stoke Newington Street Names
The History of Stoke Newington Street Names
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2023-2024 (CÓ FI...
 
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptxC1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
C1 Rubenstein AP HuG xxxxxxxxxxxxxx.pptx
 
MARY JANE WILSON, A “BOA MÃE” .
MARY JANE WILSON, A “BOA MÃE”           .MARY JANE WILSON, A “BOA MÃE”           .
MARY JANE WILSON, A “BOA MÃE” .
 
Chapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptxChapter wise All Notes of First year Basic Civil Engineering.pptx
Chapter wise All Notes of First year Basic Civil Engineering.pptx
 
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem studentsRHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
RHEOLOGY Physical pharmaceutics-II notes for B.pharm 4th sem students
 
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptxNEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
NEWSPAPERS - QUESTION 1 - REVISION POWERPOINT.pptx
 
How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience How to Create a More Engaging and Human Online Learning Experience
How to Create a More Engaging and Human Online Learning Experience
 
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
BÀI TẬP BỔ TRỢ TIẾNG ANH LỚP 9 CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC 2024-2025 - ...
 
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching AptitudeUGC NET Exam Paper 1- Unit 1:Teaching Aptitude
UGC NET Exam Paper 1- Unit 1:Teaching Aptitude
 
Hindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdfHindi varnamala | hindi alphabet PPT.pdf
Hindi varnamala | hindi alphabet PPT.pdf
 
Advanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docxAdvanced Java[Extra Concepts, Not Difficult].docx
Advanced Java[Extra Concepts, Not Difficult].docx
 
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
ISO/IEC 27001, ISO/IEC 42001, and GDPR: Best Practices for Implementation and...
 
clinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdfclinical examination of hip joint (1).pdf
clinical examination of hip joint (1).pdf
 
How to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 InventoryHow to Setup Warehouse & Location in Odoo 17 Inventory
How to Setup Warehouse & Location in Odoo 17 Inventory
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
 
How to deliver Powerpoint Presentations.pptx
How to deliver Powerpoint  Presentations.pptxHow to deliver Powerpoint  Presentations.pptx
How to deliver Powerpoint Presentations.pptx
 

Ch 1 Introduction to Object Oriented Programming.pptx

  • 1. Introduction to C++…. Procedure oriented programming: A typical program that consists of a list of instructions to accomplish a task. Larger programs are divided into a number of functions, where each function has a well defined purpose. Global data is accessible to all the functions it is difficult to find out which data is being used by which function. Changes made can affect in any manner. Global Variables Local Variables Function A Local Variables Function B
  • 2. Some important features of a procedure oriented programming language: 1. Emphasis is laid on algorithm. 2. Complex programs are divided into functions. 3. Generally functions share important data. 4. Data is passed from function to function. 5. Top down approach is used in program design. Drawback is that complexity increases as program grows larger.
  • 3. Object Oriented Programming: OOP does not allow data to move freely between the functions. It binds the data to the function that operate on it and protects it from being modified accidentally by outside functions. The object oriented approach is to combine both data and the functions that operate on that data, into a single unit called an object. Object 1 Object 2 Object 3 Member Functions Data Member Functions Data Member Functions Data
  • 4. Features of object oriented programming language: 1. Emphasis is laid on data. 2. Programs are divided into objects. 3. Objects contain the data and the functions that operate on the data. 4. Data is hidden and cannot be accessed by outside functions. 5. Objects are allowed to communicate with each other through functions. 6. Bottom Up approach is used in program design. Drawback is that complexity increases as program grows larger.
  • 5. Basic concepts used in object oriented programming: 1. Object 2. Class 3. Data Abstraction 4. Data Encapsulation 5. Inheritance 6. Reusability 7. Polymorphism 8. Dynamic binding 9. Message communication 1. Objects: Objects are entities that exhibit both state and behavior. Objects are basic runtime entities. Each object consists of data and code to manipulate the data. Employee Object: Employee Data: Name, basic_pay Functions: Read_data, Net_pay, Display Employee data -------------------- Read_data Net_pay Display
  • 6. Basic features of an object: 1. Objects are basic runtime entities. The word instance is a synonym for object. 2. They represent a person, place or any data items that the program has to handle. 3. They occupy space in memory with an associated address. 4. Objects communicate with each other by sending messages to one another.
  • 7. 2. Class: A class is a collection of similar type of objects. Object is an instance of a class. A class is created with data members and the member functions. Ex: Consider a class called shape, objects of this class would be circle, rectangle, triangle etc. object is created in this manner: class name object name; ex: shape ob1; Here shape is class and ob1 is object. 3. Data Abstraction: Data abstraction helps in binding data and the functions together. The process of representing the essential features without the background details is called abstraction.
  • 8. 4. Data Encapsulation: It binds both data and functions into a class and keeps them safe from outside functions and misuse. The data is accessible only through the functions, otherwise it remains hidden from users. This insulation of data from direct access by the program is called data hiding or information hiding. 5. Inheritance: It is a process by which an object inherits the properties of another object belonging to another class. Ex: ‘mango’ is part of the class fruit which again is part of the larger class food. The original class is known as base class and the new class is referred to as derived class or sub class.
  • 9. 6. Reusability: Once a class is created and tested and read to use, it can be distributed to other programmers for using in their programs, this is known as reusability. Inheritance supports the idea of reusability, where the programmers can add new features without modifying the existing class. 7. Polymorphism: The ability to take more than one form is called polymorphism. Ex: All brands of air conditioners do the same work, cooling the temperature. Ex: Addition operator + is used to add two values and even it is used to concatenate two strings. This process of an operator acquiring different behavior in different instances is known as operator overloading.
  • 10. 8. Dynamic binding: Binding refers to the process of resolving the function to be associated with the function call. There are two types… 1. Static binding: Binding takes place during compilation. It is also known as early binding. 2. Dynamic binding: It is also called as late binding, coz the code associated with a given function call is not known until run-time. 9. Message communication: A message is nothing but execution of a procedure. Message communication involves specifying the name of the object, name of the function and the information to be sent. For Ex: consider a class called stack. stack1.push(1); here stack1 is object, push is a function and 1 is information.
  • 11. Applications of OOP 1. Real-time systems. 2. Object oriented database. 3. Artificial intelligence and expert systems. 4. Simulation and modeling. 5. Neural networks. 6. Office automation systems.
  • 12. Difference between POP and OOP Procedure Oriented Object oriented Focus is on functions Focus is on data Data is not secured Data is secure. Uses top down programming design Uses bottom up programming design Does not model real world problem Models real world problems Programs are divided into functions Programs are divided into objects