SlideShare a Scribd company logo
Computer Programming II(CSE-1205)
Engr Md.Eftekhar Alam
Assistant Professor(CSE)
Electrical and Electronic Engineering (EEE) Department,
International Islamic University Chittagong (IIUC).
Topics:
1. Definition of OOP
2. Class and Object
3. Concept of OOP
4. Difference bet Structured Programming & OOP
5. Benefits of OOP
6. Characteristics of OOP
7. Application of OOP
2
Computer Programming II [C++]
Segment 01
Introduction to OOP
Definition of OOP
3
Object-oriented programming is a programming paradigm based on the concept of
"objects", which may contain
1. Data, in the form of fields, often known as attributes;
2. Code, in the form of procedures, often known as methods.
Introduction to Class & Object
4
 Class: Class is a user defined data type, which holds its own data members and
member functions, which can be accessed and used by creating an instance of that
class.A class is like a blueprint for an object.
 A Class is a user defined data-type which has data members and member functions.
 Data members are the data variables and member functions are the functions used to
manipulate these variables.
 Together these data members and member functions defines the properties and behavior
of the objects in a Class.
Introduction to Class & Object cont.
5
Object: An Object is an instance of a Class. When a class is defined, no memory is
allocated but when it is instantiated (i.e. an object is created) memory is allocated.
Class Name should be in PascalCase.There are two Cases.
 camelCase: userAccount
 PascalCase: UserAccount
Introduction to Class & Object cont.
6
Access Specifiers
7
1. Public: All the class members declared under public will be available to everyone.
The data members and member functions declared public can be accessed by other
classes too. The public members of a class can be accessed from anywhere in the
program using the direct member access operator (.) with the object of that class.
2. Private: The class members declared as private can be accessed only by the
functions inside the class. They are not allowed to be accessed directly by any
object or function outside the class. Only the member functions or the friend
functions are allowed to access the private data members of a class.
3. Protected: Protected access modifier is similar to that of private access
modifiers, the difference is that the class member declared as Protected are
inaccessible outside the class but they can be accessed by any subclass(derived
class) of that class.
More on OOP
8
 Object oriented programming uses objects in programming.
 Object oriented programming aims to implement real world entities like
inheritance, hiding, polymorphism etc. in programming.
 The main aim of OOP is to bind together the data and the functions that operates on
them so that no other part of code can access this data except that function.
More on OOP cont.
9
Class:
 Class is a blueprint of data and functions or methods.
 Class does not take any space.
 Class is a user defined data type like structures and unions in C.
 By default, class variables are private but in case of structure it is public.
More on OOP cont.
10
Object:
 Objects are basic run-time entities in an object-oriented system, objects are
instances of a class these are defined user defined data types.
 Object take up space in memory and have an associated address like a record in
structure in C.
 When a program is executed the objects interact by sending messages to one
another.
 Each object contains data and code to manipulate the data.
Basic concepts of OOP
11
There are three basic concepts of OOP:
1. Encapsulation
2. Inheritance
3. Polymorphism
Basic concepts of OOP cont.
12
Encapsulation:
 Encapsulation is an Object-Oriented Programming concept that binds together the
data and functions that manipulate the data, and that keeps both safe from outside
interference and misuse.
 Data encapsulation led to the important OOP concept of data hiding.
 Data encapsulation is a mechanism of bundling the data, and the functions that use
them and data abstraction is a mechanism of exposing only the interfaces and hiding
the implementation details from the user.
Basic concepts of OOP cont.
13
Inheritance: One of the most useful aspects of object-oriented programming is code
reusability via inheritance.
 Inheritance is the process by which objects of one class acquire the properties of
objects of another class.
 It supports the concept of hierarchical classification. This means that we can add
additional features to an existing class without modifying it.
 This is a very important concept of object-oriented programming since this feature
helps to reduce the code size.
Basic concepts of OOP cont.
14
Polymorphism:
Polymorphism means ability to take more than one form.
 Poly refers to many. That is a single function or an operator functioning in many
different ways upon the usage is called polymorphism.
 Polymorphism refers that an operation may exhibit different behaviors in different
instances.The behavior depends upon the types of data used in the operation.
 Polymorphism is extensively used in implementing inheritance.
Difference between Structured Programming and OOP
15
Structured Programming Object Oriented Programming
The program is divided into a number of sub-
modules or functions or procedures.
The Program is written as a collection of objects
which communicate with each other.
The flow of execution of the programming is
dependent on the structure of the program.
The basic entity is object. Each computation is
performed using objects only.
This is a top-down approach. This is a bottom-p approach.
Code is given more importance. Data is given more importance.
Less data security. More data security.
Can handle up to moderately complex programs. Can handle very complex programs.
Less code reusability. More reusability.
There are no classes and objects. Classes and objects are building blocks of this
programming.
Its approach can’t be used to model real world
objects.
Its used to model real world objects.
Absence of Encapsulation, Inheritance and
Polymorphism.
Use concepts of Encapsulation, Inheritance and
Polymorphism.
Benefits of OOP
16
1. Through inheritance, we can eliminate redundant code and extend the use of existing
classes.
2. The principle of encapsulation helps the programmer to build secure programs.
3. It is easy to partition the work in a project based on objects.
4. Object oriented system can be easily upgraded from small to large systems.
5. Software complexity can be easily managed.
6. Better reusability
7. Better maintainability
8. Better Extensibility and efficiency
9. Reduce the time and cost for development and testing.
10. Better security and abstractions
11. Protects an object from unwanted access by clients. Example: a bank account forbids a
client to change an account’s balance.
Characteristics of OOP
17
1. Emphasis on data rather than procedure
2. Programs are divided into entities known as objects
3. Data Structures are designed such that they characterize objects
4. Functions that operate on data of an object are tied together in data structures
5. Data is hidden and cannot be accessed by external functions
6. Objects communicate with each other through functions
7. New data and functions can be easily added whenever necessary
8. Follows bottom up design in program design
Application of OOP
18
 Real time systems: Real time systems inherit complexities that makes difficult to
build them. Object-oriented techniques make it easier to handle those complexities.
These techniques present ways of dealing with these complexities by providing an
integrated framework which includes schedulability analysis and behavioral
specifications.
 AI and expert systems: These are computer applications which are developed to
solve complex problems pertaining to a specific domain, which is at a level far
beyond the reach of a human brain.
 Client server systems: Object-oriented Client-Server Systems provide the IT
infrastructure, creating object-oriented Client-Server Internet (OCSI) applications.
Application of OOP cont.
19
 Object oriented databases: They are also called Object Database Management
Systems (ODBMS). These databases store objects instead of data, such as real
numbers and integers. These databases try to maintain a direct correspondence
between the real-world and database objects in order to let the object retain their
identity and integrity.
 Simulation and modeling system: It’s difficult to model complex systems due
to the varying specification of variables. These are prevalent in medicine and in other
areas of natural science, such as ecology, zoology, and agronomic systems. Object-
oriented Programming provides an alternative approach for simplifying these
complex modelling systems.
Application of OOP cont.
20
 Neural networks and parallel programming: It address the problem of
prediction and approximation of complex time-varying systems.
 Hypertext and hypermedia
 CIM/CAM/CAD systems
 Office automation system
Ad

More Related Content

Similar to Computer_Programming_Part_II_Segment_01.pdf (20)

OOP.pptx
OOP.pptxOOP.pptx
OOP.pptx
kalyanibedekar
 
CS305PC_C++_UNIT 1 notes jntuh third semester
CS305PC_C++_UNIT 1 notes jntuh third semesterCS305PC_C++_UNIT 1 notes jntuh third semester
CS305PC_C++_UNIT 1 notes jntuh third semester
VeeraswamyDasari2
 
C++ & VISUAL C++
C++ & VISUAL C++ C++ & VISUAL C++
C++ & VISUAL C++
Makaha Rutendo
 
Programming In C++
Programming In C++ Programming In C++
Programming In C++
shammi mehra
 
Object Oriented Programming Lecture Notes
Object Oriented Programming Lecture NotesObject Oriented Programming Lecture Notes
Object Oriented Programming Lecture Notes
FellowBuddy.com
 
Share Unit 1- Basic concept of object-oriented-programming.ppt
Share Unit 1- Basic concept of object-oriented-programming.pptShare Unit 1- Basic concept of object-oriented-programming.ppt
Share Unit 1- Basic concept of object-oriented-programming.ppt
hannahrroselin95
 
fileE_1722655797_5000762_Unit-1OOPS.pptx
fileE_1722655797_5000762_Unit-1OOPS.pptxfileE_1722655797_5000762_Unit-1OOPS.pptx
fileE_1722655797_5000762_Unit-1OOPS.pptx
mashokacem
 
Benefits of encapsulation
Benefits of encapsulationBenefits of encapsulation
Benefits of encapsulation
Muhammad Nawzir Khan
 
Software_Engineering_Presentation (1).pptx
Software_Engineering_Presentation (1).pptxSoftware_Engineering_Presentation (1).pptx
Software_Engineering_Presentation (1).pptx
ArifaMehreen1
 
MCA NOTES.pdf
MCA NOTES.pdfMCA NOTES.pdf
MCA NOTES.pdf
RAJASEKHARV10
 
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
 
Unit 1- Basic concept of object-oriented-programming.ppt
Unit 1- Basic concept of object-oriented-programming.pptUnit 1- Basic concept of object-oriented-programming.ppt
Unit 1- Basic concept of object-oriented-programming.ppt
hannahroseline2
 
Birasa 1
Birasa 1Birasa 1
Birasa 1
Niyitegekabilly
 
JAVA PROGRAMMING
JAVA PROGRAMMING JAVA PROGRAMMING
JAVA PROGRAMMING
Niyitegekabilly
 
Java chapter 3
Java   chapter 3Java   chapter 3
Java chapter 3
Mukesh Tekwani
 
Unit v(dsc++)
Unit v(dsc++)Unit v(dsc++)
Unit v(dsc++)
Durga Devi
 
POP vs OOP Introduction
POP vs OOP IntroductionPOP vs OOP Introduction
POP vs OOP Introduction
Hashni T
 
Oops
OopsOops
Oops
Maheswarikrishnasamy
 
Chapter1 introduction
Chapter1 introductionChapter1 introduction
Chapter1 introduction
Jeevan Acharya
 
Chapter 04 object oriented programming
Chapter 04 object oriented programmingChapter 04 object oriented programming
Chapter 04 object oriented programming
Praveen M Jigajinni
 
CS305PC_C++_UNIT 1 notes jntuh third semester
CS305PC_C++_UNIT 1 notes jntuh third semesterCS305PC_C++_UNIT 1 notes jntuh third semester
CS305PC_C++_UNIT 1 notes jntuh third semester
VeeraswamyDasari2
 
Programming In C++
Programming In C++ Programming In C++
Programming In C++
shammi mehra
 
Object Oriented Programming Lecture Notes
Object Oriented Programming Lecture NotesObject Oriented Programming Lecture Notes
Object Oriented Programming Lecture Notes
FellowBuddy.com
 
Share Unit 1- Basic concept of object-oriented-programming.ppt
Share Unit 1- Basic concept of object-oriented-programming.pptShare Unit 1- Basic concept of object-oriented-programming.ppt
Share Unit 1- Basic concept of object-oriented-programming.ppt
hannahrroselin95
 
fileE_1722655797_5000762_Unit-1OOPS.pptx
fileE_1722655797_5000762_Unit-1OOPS.pptxfileE_1722655797_5000762_Unit-1OOPS.pptx
fileE_1722655797_5000762_Unit-1OOPS.pptx
mashokacem
 
Software_Engineering_Presentation (1).pptx
Software_Engineering_Presentation (1).pptxSoftware_Engineering_Presentation (1).pptx
Software_Engineering_Presentation (1).pptx
ArifaMehreen1
 
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
 
Unit 1- Basic concept of object-oriented-programming.ppt
Unit 1- Basic concept of object-oriented-programming.pptUnit 1- Basic concept of object-oriented-programming.ppt
Unit 1- Basic concept of object-oriented-programming.ppt
hannahroseline2
 
POP vs OOP Introduction
POP vs OOP IntroductionPOP vs OOP Introduction
POP vs OOP Introduction
Hashni T
 
Chapter 04 object oriented programming
Chapter 04 object oriented programmingChapter 04 object oriented programming
Chapter 04 object oriented programming
Praveen M Jigajinni
 

Recently uploaded (20)

Little Known Ways To 3 Best sites to Buy Linkedin Accounts.pdf
Little Known Ways To 3 Best sites to Buy Linkedin Accounts.pdfLittle Known Ways To 3 Best sites to Buy Linkedin Accounts.pdf
Little Known Ways To 3 Best sites to Buy Linkedin Accounts.pdf
gori42199
 
Automatic Quality Assessment for Speech and Beyond
Automatic Quality Assessment for Speech and BeyondAutomatic Quality Assessment for Speech and Beyond
Automatic Quality Assessment for Speech and Beyond
NU_I_TODALAB
 
Artificial intelligence and machine learning.pptx
Artificial intelligence and machine learning.pptxArtificial intelligence and machine learning.pptx
Artificial intelligence and machine learning.pptx
rakshanatarajan005
 
Slide share PPT of SOx control technologies.pptx
Slide share PPT of SOx control technologies.pptxSlide share PPT of SOx control technologies.pptx
Slide share PPT of SOx control technologies.pptx
vvsasane
 
Prediction of Flexural Strength of Concrete Produced by Using Pozzolanic Mate...
Prediction of Flexural Strength of Concrete Produced by Using Pozzolanic Mate...Prediction of Flexural Strength of Concrete Produced by Using Pozzolanic Mate...
Prediction of Flexural Strength of Concrete Produced by Using Pozzolanic Mate...
Journal of Soft Computing in Civil Engineering
 
Jacob Murphy Australia - Excels In Optimizing Software Applications
Jacob Murphy Australia - Excels In Optimizing Software ApplicationsJacob Murphy Australia - Excels In Optimizing Software Applications
Jacob Murphy Australia - Excels In Optimizing Software Applications
Jacob Murphy Australia
 
Slide share PPT of NOx control technologies.pptx
Slide share PPT of  NOx control technologies.pptxSlide share PPT of  NOx control technologies.pptx
Slide share PPT of NOx control technologies.pptx
vvsasane
 
ML_Unit_VI_DEEP LEARNING_Introduction to ANN.pdf
ML_Unit_VI_DEEP LEARNING_Introduction to ANN.pdfML_Unit_VI_DEEP LEARNING_Introduction to ANN.pdf
ML_Unit_VI_DEEP LEARNING_Introduction to ANN.pdf
rameshwarchintamani
 
Empowering Electric Vehicle Charging Infrastructure with Renewable Energy Int...
Empowering Electric Vehicle Charging Infrastructure with Renewable Energy Int...Empowering Electric Vehicle Charging Infrastructure with Renewable Energy Int...
Empowering Electric Vehicle Charging Infrastructure with Renewable Energy Int...
AI Publications
 
Generative AI & Large Language Models Agents
Generative AI & Large Language Models AgentsGenerative AI & Large Language Models Agents
Generative AI & Large Language Models Agents
aasgharbee22seecs
 
Design of Variable Depth Single-Span Post.pdf
Design of Variable Depth Single-Span Post.pdfDesign of Variable Depth Single-Span Post.pdf
Design of Variable Depth Single-Span Post.pdf
Kamel Farid
 
Control Methods of Noise Pollutions.pptx
Control Methods of Noise Pollutions.pptxControl Methods of Noise Pollutions.pptx
Control Methods of Noise Pollutions.pptx
vvsasane
 
David Boutry - Specializes In AWS, Microservices And Python.pdf
David Boutry - Specializes In AWS, Microservices And Python.pdfDavid Boutry - Specializes In AWS, Microservices And Python.pdf
David Boutry - Specializes In AWS, Microservices And Python.pdf
David Boutry
 
01.คุณลักษณะเฉพาะของอุปกรณ์_pagenumber.pdf
01.คุณลักษณะเฉพาะของอุปกรณ์_pagenumber.pdf01.คุณลักษณะเฉพาะของอุปกรณ์_pagenumber.pdf
01.คุณลักษณะเฉพาะของอุปกรณ์_pagenumber.pdf
PawachMetharattanara
 
Machine Learning basics POWERPOINT PRESENETATION
Machine Learning basics POWERPOINT PRESENETATIONMachine Learning basics POWERPOINT PRESENETATION
Machine Learning basics POWERPOINT PRESENETATION
DarrinBright1
 
Machine foundation notes for civil engineering students
Machine foundation notes for civil engineering studentsMachine foundation notes for civil engineering students
Machine foundation notes for civil engineering students
DYPCET
 
22PCOAM16 ML Unit 3 Full notes PDF & QB.pdf
22PCOAM16 ML Unit 3 Full notes PDF & QB.pdf22PCOAM16 ML Unit 3 Full notes PDF & QB.pdf
22PCOAM16 ML Unit 3 Full notes PDF & QB.pdf
Guru Nanak Technical Institutions
 
sss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptx
sss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptx
sss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptx
ajayrm685
 
hypermedia_system_revisit_roy_fielding .
hypermedia_system_revisit_roy_fielding .hypermedia_system_revisit_roy_fielding .
hypermedia_system_revisit_roy_fielding .
NABLAS株式会社
 
Construction Materials (Paints) in Civil Engineering
Construction Materials (Paints) in Civil EngineeringConstruction Materials (Paints) in Civil Engineering
Construction Materials (Paints) in Civil Engineering
Lavish Kashyap
 
Little Known Ways To 3 Best sites to Buy Linkedin Accounts.pdf
Little Known Ways To 3 Best sites to Buy Linkedin Accounts.pdfLittle Known Ways To 3 Best sites to Buy Linkedin Accounts.pdf
Little Known Ways To 3 Best sites to Buy Linkedin Accounts.pdf
gori42199
 
Automatic Quality Assessment for Speech and Beyond
Automatic Quality Assessment for Speech and BeyondAutomatic Quality Assessment for Speech and Beyond
Automatic Quality Assessment for Speech and Beyond
NU_I_TODALAB
 
Artificial intelligence and machine learning.pptx
Artificial intelligence and machine learning.pptxArtificial intelligence and machine learning.pptx
Artificial intelligence and machine learning.pptx
rakshanatarajan005
 
Slide share PPT of SOx control technologies.pptx
Slide share PPT of SOx control technologies.pptxSlide share PPT of SOx control technologies.pptx
Slide share PPT of SOx control technologies.pptx
vvsasane
 
Jacob Murphy Australia - Excels In Optimizing Software Applications
Jacob Murphy Australia - Excels In Optimizing Software ApplicationsJacob Murphy Australia - Excels In Optimizing Software Applications
Jacob Murphy Australia - Excels In Optimizing Software Applications
Jacob Murphy Australia
 
Slide share PPT of NOx control technologies.pptx
Slide share PPT of  NOx control technologies.pptxSlide share PPT of  NOx control technologies.pptx
Slide share PPT of NOx control technologies.pptx
vvsasane
 
ML_Unit_VI_DEEP LEARNING_Introduction to ANN.pdf
ML_Unit_VI_DEEP LEARNING_Introduction to ANN.pdfML_Unit_VI_DEEP LEARNING_Introduction to ANN.pdf
ML_Unit_VI_DEEP LEARNING_Introduction to ANN.pdf
rameshwarchintamani
 
Empowering Electric Vehicle Charging Infrastructure with Renewable Energy Int...
Empowering Electric Vehicle Charging Infrastructure with Renewable Energy Int...Empowering Electric Vehicle Charging Infrastructure with Renewable Energy Int...
Empowering Electric Vehicle Charging Infrastructure with Renewable Energy Int...
AI Publications
 
Generative AI & Large Language Models Agents
Generative AI & Large Language Models AgentsGenerative AI & Large Language Models Agents
Generative AI & Large Language Models Agents
aasgharbee22seecs
 
Design of Variable Depth Single-Span Post.pdf
Design of Variable Depth Single-Span Post.pdfDesign of Variable Depth Single-Span Post.pdf
Design of Variable Depth Single-Span Post.pdf
Kamel Farid
 
Control Methods of Noise Pollutions.pptx
Control Methods of Noise Pollutions.pptxControl Methods of Noise Pollutions.pptx
Control Methods of Noise Pollutions.pptx
vvsasane
 
David Boutry - Specializes In AWS, Microservices And Python.pdf
David Boutry - Specializes In AWS, Microservices And Python.pdfDavid Boutry - Specializes In AWS, Microservices And Python.pdf
David Boutry - Specializes In AWS, Microservices And Python.pdf
David Boutry
 
01.คุณลักษณะเฉพาะของอุปกรณ์_pagenumber.pdf
01.คุณลักษณะเฉพาะของอุปกรณ์_pagenumber.pdf01.คุณลักษณะเฉพาะของอุปกรณ์_pagenumber.pdf
01.คุณลักษณะเฉพาะของอุปกรณ์_pagenumber.pdf
PawachMetharattanara
 
Machine Learning basics POWERPOINT PRESENETATION
Machine Learning basics POWERPOINT PRESENETATIONMachine Learning basics POWERPOINT PRESENETATION
Machine Learning basics POWERPOINT PRESENETATION
DarrinBright1
 
Machine foundation notes for civil engineering students
Machine foundation notes for civil engineering studentsMachine foundation notes for civil engineering students
Machine foundation notes for civil engineering students
DYPCET
 
sss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptx
sss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptx
sss1.pptxsss1.pptxsss1.pptxsss1.pptxsss1.pptx
ajayrm685
 
hypermedia_system_revisit_roy_fielding .
hypermedia_system_revisit_roy_fielding .hypermedia_system_revisit_roy_fielding .
hypermedia_system_revisit_roy_fielding .
NABLAS株式会社
 
Construction Materials (Paints) in Civil Engineering
Construction Materials (Paints) in Civil EngineeringConstruction Materials (Paints) in Civil Engineering
Construction Materials (Paints) in Civil Engineering
Lavish Kashyap
 
Ad

Computer_Programming_Part_II_Segment_01.pdf

  • 1. Computer Programming II(CSE-1205) Engr Md.Eftekhar Alam Assistant Professor(CSE) Electrical and Electronic Engineering (EEE) Department, International Islamic University Chittagong (IIUC).
  • 2. Topics: 1. Definition of OOP 2. Class and Object 3. Concept of OOP 4. Difference bet Structured Programming & OOP 5. Benefits of OOP 6. Characteristics of OOP 7. Application of OOP 2 Computer Programming II [C++] Segment 01 Introduction to OOP
  • 3. Definition of OOP 3 Object-oriented programming is a programming paradigm based on the concept of "objects", which may contain 1. Data, in the form of fields, often known as attributes; 2. Code, in the form of procedures, often known as methods.
  • 4. Introduction to Class & Object 4  Class: Class is a user defined data type, which holds its own data members and member functions, which can be accessed and used by creating an instance of that class.A class is like a blueprint for an object.  A Class is a user defined data-type which has data members and member functions.  Data members are the data variables and member functions are the functions used to manipulate these variables.  Together these data members and member functions defines the properties and behavior of the objects in a Class.
  • 5. Introduction to Class & Object cont. 5 Object: An Object is an instance of a Class. When a class is defined, no memory is allocated but when it is instantiated (i.e. an object is created) memory is allocated. Class Name should be in PascalCase.There are two Cases.  camelCase: userAccount  PascalCase: UserAccount
  • 6. Introduction to Class & Object cont. 6
  • 7. Access Specifiers 7 1. Public: All the class members declared under public will be available to everyone. The data members and member functions declared public can be accessed by other classes too. The public members of a class can be accessed from anywhere in the program using the direct member access operator (.) with the object of that class. 2. Private: The class members declared as private can be accessed only by the functions inside the class. They are not allowed to be accessed directly by any object or function outside the class. Only the member functions or the friend functions are allowed to access the private data members of a class. 3. Protected: Protected access modifier is similar to that of private access modifiers, the difference is that the class member declared as Protected are inaccessible outside the class but they can be accessed by any subclass(derived class) of that class.
  • 8. More on OOP 8  Object oriented programming uses objects in programming.  Object oriented programming aims to implement real world entities like inheritance, hiding, polymorphism etc. in programming.  The main aim of OOP is to bind together the data and the functions that operates on them so that no other part of code can access this data except that function.
  • 9. More on OOP cont. 9 Class:  Class is a blueprint of data and functions or methods.  Class does not take any space.  Class is a user defined data type like structures and unions in C.  By default, class variables are private but in case of structure it is public.
  • 10. More on OOP cont. 10 Object:  Objects are basic run-time entities in an object-oriented system, objects are instances of a class these are defined user defined data types.  Object take up space in memory and have an associated address like a record in structure in C.  When a program is executed the objects interact by sending messages to one another.  Each object contains data and code to manipulate the data.
  • 11. Basic concepts of OOP 11 There are three basic concepts of OOP: 1. Encapsulation 2. Inheritance 3. Polymorphism
  • 12. Basic concepts of OOP cont. 12 Encapsulation:  Encapsulation is an Object-Oriented Programming concept that binds together the data and functions that manipulate the data, and that keeps both safe from outside interference and misuse.  Data encapsulation led to the important OOP concept of data hiding.  Data encapsulation is a mechanism of bundling the data, and the functions that use them and data abstraction is a mechanism of exposing only the interfaces and hiding the implementation details from the user.
  • 13. Basic concepts of OOP cont. 13 Inheritance: One of the most useful aspects of object-oriented programming is code reusability via inheritance.  Inheritance is the process by which objects of one class acquire the properties of objects of another class.  It supports the concept of hierarchical classification. This means that we can add additional features to an existing class without modifying it.  This is a very important concept of object-oriented programming since this feature helps to reduce the code size.
  • 14. Basic concepts of OOP cont. 14 Polymorphism: Polymorphism means ability to take more than one form.  Poly refers to many. That is a single function or an operator functioning in many different ways upon the usage is called polymorphism.  Polymorphism refers that an operation may exhibit different behaviors in different instances.The behavior depends upon the types of data used in the operation.  Polymorphism is extensively used in implementing inheritance.
  • 15. Difference between Structured Programming and OOP 15 Structured Programming Object Oriented Programming The program is divided into a number of sub- modules or functions or procedures. The Program is written as a collection of objects which communicate with each other. The flow of execution of the programming is dependent on the structure of the program. The basic entity is object. Each computation is performed using objects only. This is a top-down approach. This is a bottom-p approach. Code is given more importance. Data is given more importance. Less data security. More data security. Can handle up to moderately complex programs. Can handle very complex programs. Less code reusability. More reusability. There are no classes and objects. Classes and objects are building blocks of this programming. Its approach can’t be used to model real world objects. Its used to model real world objects. Absence of Encapsulation, Inheritance and Polymorphism. Use concepts of Encapsulation, Inheritance and Polymorphism.
  • 16. Benefits of OOP 16 1. Through inheritance, we can eliminate redundant code and extend the use of existing classes. 2. The principle of encapsulation helps the programmer to build secure programs. 3. It is easy to partition the work in a project based on objects. 4. Object oriented system can be easily upgraded from small to large systems. 5. Software complexity can be easily managed. 6. Better reusability 7. Better maintainability 8. Better Extensibility and efficiency 9. Reduce the time and cost for development and testing. 10. Better security and abstractions 11. Protects an object from unwanted access by clients. Example: a bank account forbids a client to change an account’s balance.
  • 17. Characteristics of OOP 17 1. Emphasis on data rather than procedure 2. Programs are divided into entities known as objects 3. Data Structures are designed such that they characterize objects 4. Functions that operate on data of an object are tied together in data structures 5. Data is hidden and cannot be accessed by external functions 6. Objects communicate with each other through functions 7. New data and functions can be easily added whenever necessary 8. Follows bottom up design in program design
  • 18. Application of OOP 18  Real time systems: Real time systems inherit complexities that makes difficult to build them. Object-oriented techniques make it easier to handle those complexities. These techniques present ways of dealing with these complexities by providing an integrated framework which includes schedulability analysis and behavioral specifications.  AI and expert systems: These are computer applications which are developed to solve complex problems pertaining to a specific domain, which is at a level far beyond the reach of a human brain.  Client server systems: Object-oriented Client-Server Systems provide the IT infrastructure, creating object-oriented Client-Server Internet (OCSI) applications.
  • 19. Application of OOP cont. 19  Object oriented databases: They are also called Object Database Management Systems (ODBMS). These databases store objects instead of data, such as real numbers and integers. These databases try to maintain a direct correspondence between the real-world and database objects in order to let the object retain their identity and integrity.  Simulation and modeling system: It’s difficult to model complex systems due to the varying specification of variables. These are prevalent in medicine and in other areas of natural science, such as ecology, zoology, and agronomic systems. Object- oriented Programming provides an alternative approach for simplifying these complex modelling systems.
  • 20. Application of OOP cont. 20  Neural networks and parallel programming: It address the problem of prediction and approximation of complex time-varying systems.  Hypertext and hypermedia  CIM/CAM/CAD systems  Office automation system
  翻译: