SlideShare a Scribd company logo
1 of 31
Download to read offline
Object Oriented
ConceptsConcepts
Mrs. Pranali P. Chaudhari
Contents
Procedural Programming Concepts
Object Oriented ConceptsObject Oriented Concepts
Features, Advantages and Applications of
OOP
Quiz 1
What is a programming language?
A programming language is a formal
language that specifies a set of instructions that
can be used to produce various kinds of output.
A language used by programmers to write
instructions that a computer can understand to do
what the programmer (or the computer user) wants.
Procedural Programming Techniques
Focuses on Functions.
Data items are defined as global.
All functions access the global data item freely.
Each function is having its own local data.
It employs top-down approach.
Procedural Programming Techniques
Global Data Global Data
Function - 1
Local Data
Function - 2
Local Data
Function - 3
Local Data
Quiz 2
Give example of procedural language.
C, FORTRAN, Pascal....
Who developed C language?
Dennis Ritchie
Object Oriented Programming
Focuses on Data.
Problem is decomposed into number entities
called objects.
Data is not defined as global
Data of an object can be accessed by the
functions associated with that object.
Functions of one object can access functions of
other objects.
Object Oriented Programming
Functions
Data
Object A
Functions
Data
Object B
Functions Functions
Functions
Data
Object C
Procedural Vs Object Oriented
Procedural Programming Object Oriented Programming
Focuses on Functions Focuses on Data
Uses/ define Global data Data is not defined as global
Functions access same data item Only the functions associated with
the object can access the data
item.
Top down approach Bottom up approach
Quiz 3
Give examples of Object Oriented
Languages.
C++, Java, C# ......
Who developed C++?
Bjarne Stroustrup
OOPS Basic Concepts
Objects
Data
Member functions
ClassClass
Data Abstraction and Encapsulation
Inheritance
Polymorphism
Dynamic Binding
Message Passing
Objects
OBJECT
DATA
Objects are the basic run-time
entities in an object oriented system.
For eg: person, bank account, an
FUNCTIONS
item.
Objects interacts with other objects
by sending messages to one another.
Each object consists of data items
and the functions to manipulate that
data.
Classes
A class is a collection of objects of similar type.
It is a user defined data type.
Object are variables of the type class.Object are variables of the type class.
For eg: mango, apple, orange are the objects of
fruit class.
Once the class is defined we can create any
number of objects.
Data Abstraction & Encapsulation
Wrapping up of data and functions into a single
unit is known as Encapsulation. Eg: quadratic
equations.
Abstraction refers to the act of representing
essential features without including the
background details. Eg: automobile company.
Inheritance
Inheritance is the process by which objects of
one class acquire the properties of objects of
another class.another class.
The concept of inheritance provides the idea of
reusability.
Class animals is divided into mammals,
amphibians, insects, birds etc.
Inheritance
Base Class
Feature A
Feature B
Feature A
Feature B
Feature C
Feature A
Feature B
Feature D
Feature A
Feature B
Feature F
Feature C
Derived Class
Polymorphism
Polymorphism means the ability to take
more than one form.
In oops it is achieved through:
Operator Overloading
Function Overloading.
Operator Overloading
The process of making an operator to
exhibit different behaviors in different
instances is known as operator
overloading.
Addition operation example.
Function Overloading
Shape
Using the same function name to perform
different type of tasks is known as function
overloading.
Draw()
Box Object
Draw(Box)
Triangle Object
Draw(Triangle)
Circle Object
Draw(Circle)
Dynamic Binding
Binding refers to the linking of a procedure
call to the code to be executed in
response to a call.
Dynamic Binding means the code
associated with the call is not known until
the time of the call at run-time.
Message Passing
A message for an object is a request for
execution of a procedure.
Message passing involves specifying the
name of the object, the name of the
function and the information to be sent.
employee.salary(name)
Features of OOPs
Emphasis is on data rather than procedure.
Programs are divided into objects.
Data structures are designed such that they characterise
the objects.
Functions that operate on data of an object are tiedFunctions that operate on data of an object are tied
together in the data structure.
Data is hidden and cannot be accessed by external
functions.
Objects may communicate with each other through
functions.
New data and functions can be easily added whenever
necessary.
Follows bottom up approach in program design.
Benefits of OOP
Modularity for easier troubleshooting
Reuse of code through inheritanceReuse of code through inheritance
Flexibility through polymorphism
Effective problem solving
Applications of OOP
Real time systems
Simulation and Modelling
Object Oriented Databases
AI and Expert Systems
Neural Network and parallel programming
Decision support and automation systems.
First C++ Program
# include<iostream.h>
using namespace std;
int main()int main()
{
cout<<“Hello World”;
return 0;
}
C Vs C++ Program
C Program
# include <stdio.h>
main()
C++ Program
# include <iostream>
using namespace std;
main()
{
printf(“Hello World”);
}
int main()
{
cout<< “ Hello World”;
return 0;
}
C++ Program with Class
# include<iostream>
using namespace std;
class person
{
char name[30];
int age;
public:
void person :: display(void)
{
cout << “n Name : “ << name;
cout << “n Age : “ << age;
}
int main()public:
void getdata(void);
void display(void);
};
void person :: getdata(void)
{
cout<< “ Enter Name : “;
cin>> name;
cout<<“ Enter Age : “;
cin>> age;
}
int main()
{
person p;
p.getdata();
p.display();
return 0 ;
}
Structure of C++ Program
Include Files
Class declaration
Member functions definitions
Main function Program
Summary
OOPs focuses on ____________.
________ is a run time entity.
Class is also known as _____________.
________ provides the idea of reusability.________ provides the idea of reusability.
Objects can communicate with each other
through _________.
Polymorphism is achieved through ________
and __________.
References
Object Oriented Programming with C++ by
E Balagurusamy.E Balagurusamy.
END OF UNIT

More Related Content

What's hot

Virtual base class
Virtual base classVirtual base class
Virtual base classTech_MX
 
Class and object in c++
Class and object in c++Class and object in c++
Class and object in c++NainaKhan28
 
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
 
virtual function
virtual functionvirtual function
virtual functionVENNILAV6
 
object oriented Programming ppt
object oriented Programming pptobject oriented Programming ppt
object oriented Programming pptNitesh Dubey
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programmingAmit Soni (CTFL)
 
Access modifiers
Access modifiersAccess modifiers
Access modifiersJadavsejal
 
Polymorphism in Python
Polymorphism in Python Polymorphism in Python
Polymorphism in Python Home
 
Object Oriented Programming Concepts
Object Oriented Programming ConceptsObject Oriented Programming Concepts
Object Oriented Programming Conceptsthinkphp
 
Access specifier
Access specifierAccess specifier
Access specifierzindadili
 
Operator Overloading
Operator OverloadingOperator Overloading
Operator OverloadingNilesh Dalvi
 
classes and objects in C++
classes and objects in C++classes and objects in C++
classes and objects in C++HalaiHansaika
 
Inheritance : Extending Classes
Inheritance : Extending ClassesInheritance : Extending Classes
Inheritance : Extending ClassesNilesh Dalvi
 
Object Oriented Language
Object Oriented LanguageObject Oriented Language
Object Oriented Languagedheva B
 
Polymorphism Using C++
Polymorphism Using C++Polymorphism Using C++
Polymorphism Using C++PRINCE KUMAR
 
Object Oriented Programming Using C++
Object Oriented Programming Using C++Object Oriented Programming Using C++
Object Oriented Programming Using C++Muhammad Waqas
 

What's hot (20)

Virtual base class
Virtual base classVirtual base class
Virtual base class
 
Class and object in c++
Class and object in c++Class and object in c++
Class and object in c++
 
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
 
virtual function
virtual functionvirtual function
virtual function
 
object oriented Programming ppt
object oriented Programming pptobject oriented Programming ppt
object oriented Programming ppt
 
Polymorphism
PolymorphismPolymorphism
Polymorphism
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
 
Operator overloading
Operator overloadingOperator overloading
Operator overloading
 
Access modifiers
Access modifiersAccess modifiers
Access modifiers
 
Polymorphism in Python
Polymorphism in Python Polymorphism in Python
Polymorphism in Python
 
Object Oriented Programming Concepts
Object Oriented Programming ConceptsObject Oriented Programming Concepts
Object Oriented Programming Concepts
 
Access specifier
Access specifierAccess specifier
Access specifier
 
Object oriented programming
Object oriented programmingObject oriented programming
Object oriented programming
 
Operator Overloading
Operator OverloadingOperator Overloading
Operator Overloading
 
classes and objects in C++
classes and objects in C++classes and objects in C++
classes and objects in C++
 
Inheritance : Extending Classes
Inheritance : Extending ClassesInheritance : Extending Classes
Inheritance : Extending Classes
 
Function overloading ppt
Function overloading pptFunction overloading ppt
Function overloading ppt
 
Object Oriented Language
Object Oriented LanguageObject Oriented Language
Object Oriented Language
 
Polymorphism Using C++
Polymorphism Using C++Polymorphism Using C++
Polymorphism Using C++
 
Object Oriented Programming Using C++
Object Oriented Programming Using C++Object Oriented Programming Using C++
Object Oriented Programming Using C++
 

Similar to Object oriented concepts

Similar to Object oriented concepts (20)

OOPS_Unit_1
OOPS_Unit_1OOPS_Unit_1
OOPS_Unit_1
 
Chapter1 introduction
Chapter1 introductionChapter1 introduction
Chapter1 introduction
 
OOP.pptx
OOP.pptxOOP.pptx
OOP.pptx
 
POP vs OOP Introduction
POP vs OOP IntroductionPOP vs OOP Introduction
POP vs OOP Introduction
 
Bca 2nd sem u-1 iintroduction
Bca 2nd sem u-1 iintroductionBca 2nd sem u-1 iintroduction
Bca 2nd sem u-1 iintroduction
 
C++Day-1 Introduction.ppt
C++Day-1 Introduction.pptC++Day-1 Introduction.ppt
C++Day-1 Introduction.ppt
 
Object Oriented Programming Lecture Notes
Object Oriented Programming Lecture NotesObject Oriented Programming Lecture Notes
Object Oriented Programming Lecture Notes
 
Object oriented programming C++
Object oriented programming C++Object oriented programming C++
Object oriented programming C++
 
Oops concepts || Object Oriented Programming Concepts in Java
Oops concepts || Object Oriented Programming Concepts in JavaOops concepts || Object Oriented Programming Concepts in Java
Oops concepts || Object Oriented Programming Concepts in Java
 
Mca 2 sem u-1 iintroduction
Mca 2 sem u-1 iintroductionMca 2 sem u-1 iintroduction
Mca 2 sem u-1 iintroduction
 
OOP ppt.pdf
OOP ppt.pdfOOP ppt.pdf
OOP ppt.pdf
 
JAVA PROGRAMMING
JAVA PROGRAMMING JAVA PROGRAMMING
JAVA PROGRAMMING
 
Birasa 1
Birasa 1Birasa 1
Birasa 1
 
chapter - 1.ppt
chapter - 1.pptchapter - 1.ppt
chapter - 1.ppt
 
1 intro
1 intro1 intro
1 intro
 
CPP_,module2_1.pptx
CPP_,module2_1.pptxCPP_,module2_1.pptx
CPP_,module2_1.pptx
 
JAVA PROGRAMMINGD
JAVA PROGRAMMINGDJAVA PROGRAMMINGD
JAVA PROGRAMMINGD
 
Chapter1
Chapter1Chapter1
Chapter1
 
INTRODUCTION TO JAVA
INTRODUCTION TO JAVAINTRODUCTION TO JAVA
INTRODUCTION TO JAVA
 
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
 

More from Pranali Chaudhari (8)

Exception handling
Exception handlingException handling
Exception handling
 
Files and streams
Files and streamsFiles and streams
Files and streams
 
Templates
TemplatesTemplates
Templates
 
Managing I/O in c++
Managing I/O in c++Managing I/O in c++
Managing I/O in c++
 
Inheritance
InheritanceInheritance
Inheritance
 
Constructors destructors
Constructors destructorsConstructors destructors
Constructors destructors
 
Functions in C++
Functions in C++Functions in C++
Functions in C++
 
Introduction to C++
Introduction to C++Introduction to C++
Introduction to C++
 

Recently uploaded

ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomnelietumpap1
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Mark Reed
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
Romantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxRomantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxsqpmdrvczh
 
Atmosphere science 7 quarter 4 .........
Atmosphere science 7 quarter 4 .........Atmosphere science 7 quarter 4 .........
Atmosphere science 7 quarter 4 .........LeaCamillePacle
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptxSherlyMaeNeri
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementmkooblal
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
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
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxAnupkumar Sharma
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatYousafMalik24
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...Nguyen Thanh Tu Collection
 
Planning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptxPlanning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptxLigayaBacuel1
 
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
 

Recently uploaded (20)

Rapple "Scholarly Communications and the Sustainable Development Goals"
Rapple "Scholarly Communications and the Sustainable Development Goals"Rapple "Scholarly Communications and the Sustainable Development Goals"
Rapple "Scholarly Communications and the Sustainable Development Goals"
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
ENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choomENGLISH6-Q4-W3.pptxqurter our high choom
ENGLISH6-Q4-W3.pptxqurter our high choom
 
Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)Influencing policy (training slides from Fast Track Impact)
Influencing policy (training slides from Fast Track Impact)
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
Romantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptxRomantic Opera MUSIC FOR GRADE NINE pptx
Romantic Opera MUSIC FOR GRADE NINE pptx
 
Atmosphere science 7 quarter 4 .........
Atmosphere science 7 quarter 4 .........Atmosphere science 7 quarter 4 .........
Atmosphere science 7 quarter 4 .........
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
Judging the Relevance and worth of ideas part 2.pptx
Judging the Relevance  and worth of ideas part 2.pptxJudging the Relevance  and worth of ideas part 2.pptx
Judging the Relevance and worth of ideas part 2.pptx
 
Hierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of managementHierarchy of management that covers different levels of management
Hierarchy of management that covers different levels of management
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
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
 
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptxMULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
MULTIDISCIPLINRY NATURE OF THE ENVIRONMENTAL STUDIES.pptx
 
Earth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice greatEarth Day Presentation wow hello nice great
Earth Day Presentation wow hello nice great
 
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
HỌC TỐT TIẾNG ANH 11 THEO CHƯƠNG TRÌNH GLOBAL SUCCESS ĐÁP ÁN CHI TIẾT - CẢ NĂ...
 
Raw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptxRaw materials used in Herbal Cosmetics.pptx
Raw materials used in Herbal Cosmetics.pptx
 
Planning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptxPlanning a health career 4th Quarter.pptx
Planning a health career 4th Quarter.pptx
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 

Object oriented concepts

  • 2. Contents Procedural Programming Concepts Object Oriented ConceptsObject Oriented Concepts Features, Advantages and Applications of OOP
  • 3. Quiz 1 What is a programming language? A programming language is a formal language that specifies a set of instructions that can be used to produce various kinds of output. A language used by programmers to write instructions that a computer can understand to do what the programmer (or the computer user) wants.
  • 4. Procedural Programming Techniques Focuses on Functions. Data items are defined as global. All functions access the global data item freely. Each function is having its own local data. It employs top-down approach.
  • 5. Procedural Programming Techniques Global Data Global Data Function - 1 Local Data Function - 2 Local Data Function - 3 Local Data
  • 6. Quiz 2 Give example of procedural language. C, FORTRAN, Pascal.... Who developed C language? Dennis Ritchie
  • 7. Object Oriented Programming Focuses on Data. Problem is decomposed into number entities called objects. Data is not defined as global Data of an object can be accessed by the functions associated with that object. Functions of one object can access functions of other objects.
  • 8. Object Oriented Programming Functions Data Object A Functions Data Object B Functions Functions Functions Data Object C
  • 9. Procedural Vs Object Oriented Procedural Programming Object Oriented Programming Focuses on Functions Focuses on Data Uses/ define Global data Data is not defined as global Functions access same data item Only the functions associated with the object can access the data item. Top down approach Bottom up approach
  • 10. Quiz 3 Give examples of Object Oriented Languages. C++, Java, C# ...... Who developed C++? Bjarne Stroustrup
  • 11. OOPS Basic Concepts Objects Data Member functions ClassClass Data Abstraction and Encapsulation Inheritance Polymorphism Dynamic Binding Message Passing
  • 12. Objects OBJECT DATA Objects are the basic run-time entities in an object oriented system. For eg: person, bank account, an FUNCTIONS item. Objects interacts with other objects by sending messages to one another. Each object consists of data items and the functions to manipulate that data.
  • 13. Classes A class is a collection of objects of similar type. It is a user defined data type. Object are variables of the type class.Object are variables of the type class. For eg: mango, apple, orange are the objects of fruit class. Once the class is defined we can create any number of objects.
  • 14. Data Abstraction & Encapsulation Wrapping up of data and functions into a single unit is known as Encapsulation. Eg: quadratic equations. Abstraction refers to the act of representing essential features without including the background details. Eg: automobile company.
  • 15. Inheritance Inheritance is the process by which objects of one class acquire the properties of objects of another class.another class. The concept of inheritance provides the idea of reusability. Class animals is divided into mammals, amphibians, insects, birds etc.
  • 16. Inheritance Base Class Feature A Feature B Feature A Feature B Feature C Feature A Feature B Feature D Feature A Feature B Feature F Feature C Derived Class
  • 17. Polymorphism Polymorphism means the ability to take more than one form. In oops it is achieved through: Operator Overloading Function Overloading.
  • 18. Operator Overloading The process of making an operator to exhibit different behaviors in different instances is known as operator overloading. Addition operation example.
  • 19. Function Overloading Shape Using the same function name to perform different type of tasks is known as function overloading. Draw() Box Object Draw(Box) Triangle Object Draw(Triangle) Circle Object Draw(Circle)
  • 20. Dynamic Binding Binding refers to the linking of a procedure call to the code to be executed in response to a call. Dynamic Binding means the code associated with the call is not known until the time of the call at run-time.
  • 21. Message Passing A message for an object is a request for execution of a procedure. Message passing involves specifying the name of the object, the name of the function and the information to be sent. employee.salary(name)
  • 22. Features of OOPs Emphasis is on data rather than procedure. Programs are divided into objects. Data structures are designed such that they characterise the objects. Functions that operate on data of an object are tiedFunctions that operate on data of an object are tied together in the data structure. Data is hidden and cannot be accessed by external functions. Objects may communicate with each other through functions. New data and functions can be easily added whenever necessary. Follows bottom up approach in program design.
  • 23. Benefits of OOP Modularity for easier troubleshooting Reuse of code through inheritanceReuse of code through inheritance Flexibility through polymorphism Effective problem solving
  • 24. Applications of OOP Real time systems Simulation and Modelling Object Oriented Databases AI and Expert Systems Neural Network and parallel programming Decision support and automation systems.
  • 25. First C++ Program # include<iostream.h> using namespace std; int main()int main() { cout<<“Hello World”; return 0; }
  • 26. C Vs C++ Program C Program # include <stdio.h> main() C++ Program # include <iostream> using namespace std; main() { printf(“Hello World”); } int main() { cout<< “ Hello World”; return 0; }
  • 27. C++ Program with Class # include<iostream> using namespace std; class person { char name[30]; int age; public: void person :: display(void) { cout << “n Name : “ << name; cout << “n Age : “ << age; } int main()public: void getdata(void); void display(void); }; void person :: getdata(void) { cout<< “ Enter Name : “; cin>> name; cout<<“ Enter Age : “; cin>> age; } int main() { person p; p.getdata(); p.display(); return 0 ; }
  • 28. Structure of C++ Program Include Files Class declaration Member functions definitions Main function Program
  • 29. Summary OOPs focuses on ____________. ________ is a run time entity. Class is also known as _____________. ________ provides the idea of reusability.________ provides the idea of reusability. Objects can communicate with each other through _________. Polymorphism is achieved through ________ and __________.
  • 30. References Object Oriented Programming with C++ by E Balagurusamy.E Balagurusamy.