C++ OOPS CONCEPTS
Dr. Bhargavi Goswami
CHRIST
Bangalore
bhargavigoswami@gmail.com
+91 9426669020
BOOKS
 Schildt Herbert, The Complete Reference C+
+, Tata McGraw Hill, Reprint, 2012.
 Deitel&Deitel, C++ How to program, Pearson
Education Asia, 6th Edition, 2008.
 Bjarne Stroustrup, The C++ Programming
Language, Special Edition, Pearson
Education, 2010.
 M. T. Somashekara, D. S. Guru, Object-
Oriented Programming with C++, 2ndEdition,
PHI, 2012.
BEST SUITABLE TO SYLLABUS
 E Balagurusami, Object Oriented
Programming with C++, McGraw Hill
Education, 6th
Edition, 2013.
 Syllabus includes: Chapter 1 to 11.
TOPIC LIST
 Software Evolution
 Procedure Oriented Programming
 Object Oriented Programming
 Objects
 Classes
 Abstraction
 Encapsulation
 Inheritance
 Polymorphism
 Dynamic Binding
SOFTWARE CRISIS
Real life problems
Open Interface
Reusability
Tolerant to Updates
Software Quality & Productivity
Decrease S/w Cost
Manage Schedule
NEED TO ADDRESS ISSUES:
 How to represent real life entities of problems in
system design?
 How to design a system with open interfaces?
 How to ensure reusability and extensibility of modules?
 How to develop modules that are tolerant to any
changes in future?
 How to improve software productivity and decrease
software cost?
 How to improve the quality of software?
 How to manage time schedules?
 How to industrialize the software development
process?
SOME FACTS AND REPORTS
50% of software products, never
delivered.
33% of delivered software are
never used.
2% used without changes once
delivered.
CONCLUSION
Bad record of s/w industry in
delivering products.
Reason?
1. Changes in user requirements
2. Changes in Data Formats
US DEFENSE PROJECT STATUS
Paid but not
received
Delivered
but not
used
Ababdoned,
Not
reworked
Used after
Changes
Used as
Delivered
0
1
2
3
4
5
6
HOW TO EVALUATE A SYSTEM
(DEVELOPED SOFTWARE)?
 Correctness
 Maintainability
 Reusability
 Openness and Interoperability
 Portability
 Security
 Integrity
 User Friendliness
MAINTENANCE:
EXPECTED CHANGES
User
Requiremen
t
42%
Data Formats
18%
Emergency
12%
Routine
Debugging
9%
H/w
Changes
6%
Documentat
ion
6%
Other
3%
Efficiency
4%
QUALITY ISSUES
HOW TO EVALUATE A SYSTEM
(DEVELOPED SOFTWARE)?
Correctness
Maintainability
Reusability
Interoperability
Integrity
Portability
User
Friendly
Security
SOFTWARE EVALUATION
Object Oriented Lang
Procedure Oriented
Lang
Assembly Lang
Machine Lang
1.0
PROCEDURAL / STRUCTURAL
PROGRAMMING LANGUAGE
 Eg. COBOL, FORTRAN, C, etc
 Imp. Focus: Problem
 Solution: Provided with Functions and Procedures
 How: Hierarchical Decomposition
 Writes list of instructions / action / flowcharts
 But, we least concerned about data and its flow.
 Risk for global multi-procedural data.
 Not Secure
 Vulnerable to accidental modifications of data.
 Bugs may creep in
 Do not model real life problems well
STRUCTURE OF PROCEDURAL
LANGAUGE
Main Program
Function
1
Function
2
Function
3
Function
4
Function
5
Function
6
CHARACTERISTICS
 Emphasis on Algorithm
 Divide and Rule (small program as function)
 Share global data
 Data movement is open in function
 Function transform data
 Top Down Approach
RELATIONSHIP OF DATA AND
FUNCTION IN PROCEDURAL LANG
Global Data Global Data
Function 1
Local Data
Function 2
Local Data
Function 3
Local Data
OBJECT ORIENTED
PROGRAMMING LANGUAGE
 Here, data is critical element
 Data does not flow freely in program
 Function – Data coupling is tight
 Protection from accidental modifications
 Decomposition of problem into #objects /
entries.
 These objects are using function built data.
 Functions of objects can communicate.
ORGANIZATION OF DATA &
FUNCTION IN OOP
Data
Function
Object A
Data
Function
Object B
Data
Function
Object C
Function of objects
Communicate.
CHARACTERISTICS
 Emphasis on Data
 Programs are divided into objects
 Data characterized by objects tied with
functions
 Data is hidden
 Way of communication is through functions
 New Data and Functions can be created
easily.
 Follow bottom up approach.
BASICS OF OOP
Objects
Classes
Data
Abstraction &
Encapsulation
Inheritance
Dynamic
Binding
Polymorphism
Message
Passing
OBJECTS
 Basic Runtime Entities
 Customer, Account, Objects
 Bank balance is data.
 Balance sheet is a function.
 Object has data and code (function).
 See next fig.
DESIGN OF OOP
Object
Student
Data:
Name
Birthday
Marks
Course
Functions:
Total
Average
Display
CLASSES
 Entire set of object’s data and code can be
defined as user defined data-type called
“class”.
 Objects are variables of type class.
 Class is a collection of objects.
 Eg. Mango, apple, orange are objects of class
“Fruits”.
DATA ABSTRACTION &
ENCAPSULATION
 Wrapping of data and function into single class is
“Encapsulation”.
 Data is secure once encapsulated in class.
 Functions connect class and object.
 Avoiding data access other than class is facilitating
“data hiding”.
 “Abstraction” is representing essential features without
including background information / explanation.
 Abstract information / attributes eg. Size, cost, length,
etc.
 Abstraction is done using data members as they hold
information.
 Classes are also called ADT: Abstract Data Types
INHERITANCE
 Reusability
 Class
features
can be
inherited
to other
classes
 Tailoring of
features is
also
possible
Bird:
Feather
Eggs
Flying Bird:
Size of
Wings
Non Flying
Birds:
Weight
Robin Kiwi
Swallow Penguin
POLYMORPHISM
 Operation exhibit different behavior based
on provided type of data.
 Eg. Add(num1,num2) does addition
Add(str1,str2) does concatenation
 Obtained by operator or function
overloading.
 Allow different internal structures to use
same external interface
 Also used in implementing inheritance
 Done preferably using Function Overloading.
POLYMORPHISM
Shape
Draw
(Circle)
Draw
(Box)
Draw
(Triangle)
DYNAMIC BINDING
 Also called Late binding
 Dynamically, draw a procedure that will take
actions based on type of object provided.
 Same as figure, if circle is provided, draws
circle.
MESSAGE PASSING
 A message for an object is a request for execution of a
procedure and therefore will invoke function that
generates result.
 Steps:
 Create Class (create members, functions)
 Create Objects
 Communication happens using functions to obtain
desired results.
Employee.salary(name)
Object Message Information
BENEFITS OF OOP
 Greater productivity, better quality of s/w,
less maintenance.
 Inheritance: Code Reusability and reduced
redundancy
 Reuse of standard working modules, save
time.
 Data Hiding: Secure
 Multiple instance of an object can co-exist
 Map Objects in problem domain
 Problem partition in project based objects
BENEFITS OF OOP
 Data center design, modeling of problem,
solution implementation easy.
 Bottom Up Approach
 Encapsulates details
 Message passing system is very simple.
 Easy to manage s/w complexity
 Compatible with C Language.
LIMITATIONS
Limited
standard
library
Limited GUI
Support
Difficult to
implement
web
applications
Thread not
supported
APPLICATIONS: C++/C# IS USED
IN
 Real-time systems
 Simulations and Modeling
 Object oriented Databases
 Hypertext, hypermedia and expertext
 Artificial Intelligence
 Developing Expert Systems
 Neural networks and parallel programming
 Decision Support and Office Automation System
 CAD Systems
 Internet of Things
 Embedded Programming
 Compiler and Operating System development
 Developing new programming language
QUESTION?
 What do you think are the major issues
facing the software industry?
 Explain Software Evolution.
 How are the data and functions are
organized in OOP?
 List down unique advantages of OOP.
 List 20 real world objects.
 List down the advantages of inheritance.
 List applications of C++
DIFFERENTIATE
 Procedure oriented v/s Object Oriented
 Object v/s Class
 Data Abstraction v/s Data Encapsulation
 Inheritance v/s Polymorphism
 Dynamic binding v/s Message Passing
THANK YOU.
SEE YOU SOON.
Explore more about the topic.

2-oops-concepts_about_c++_btech_cse.pptx

  • 1.
    C++ OOPS CONCEPTS Dr.Bhargavi Goswami CHRIST Bangalore bhargavigoswami@gmail.com +91 9426669020
  • 2.
    BOOKS  Schildt Herbert,The Complete Reference C+ +, Tata McGraw Hill, Reprint, 2012.  Deitel&Deitel, C++ How to program, Pearson Education Asia, 6th Edition, 2008.  Bjarne Stroustrup, The C++ Programming Language, Special Edition, Pearson Education, 2010.  M. T. Somashekara, D. S. Guru, Object- Oriented Programming with C++, 2ndEdition, PHI, 2012.
  • 3.
    BEST SUITABLE TOSYLLABUS  E Balagurusami, Object Oriented Programming with C++, McGraw Hill Education, 6th Edition, 2013.  Syllabus includes: Chapter 1 to 11.
  • 4.
    TOPIC LIST  SoftwareEvolution  Procedure Oriented Programming  Object Oriented Programming  Objects  Classes  Abstraction  Encapsulation  Inheritance  Polymorphism  Dynamic Binding
  • 5.
    SOFTWARE CRISIS Real lifeproblems Open Interface Reusability Tolerant to Updates Software Quality & Productivity Decrease S/w Cost Manage Schedule
  • 6.
    NEED TO ADDRESSISSUES:  How to represent real life entities of problems in system design?  How to design a system with open interfaces?  How to ensure reusability and extensibility of modules?  How to develop modules that are tolerant to any changes in future?  How to improve software productivity and decrease software cost?  How to improve the quality of software?  How to manage time schedules?  How to industrialize the software development process?
  • 7.
    SOME FACTS ANDREPORTS 50% of software products, never delivered. 33% of delivered software are never used. 2% used without changes once delivered.
  • 8.
    CONCLUSION Bad record ofs/w industry in delivering products. Reason? 1. Changes in user requirements 2. Changes in Data Formats
  • 9.
    US DEFENSE PROJECTSTATUS Paid but not received Delivered but not used Ababdoned, Not reworked Used after Changes Used as Delivered 0 1 2 3 4 5 6
  • 10.
    HOW TO EVALUATEA SYSTEM (DEVELOPED SOFTWARE)?  Correctness  Maintainability  Reusability  Openness and Interoperability  Portability  Security  Integrity  User Friendliness
  • 11.
  • 12.
    QUALITY ISSUES HOW TOEVALUATE A SYSTEM (DEVELOPED SOFTWARE)? Correctness Maintainability Reusability Interoperability Integrity Portability User Friendly Security
  • 13.
    SOFTWARE EVALUATION Object OrientedLang Procedure Oriented Lang Assembly Lang Machine Lang 1.0
  • 14.
    PROCEDURAL / STRUCTURAL PROGRAMMINGLANGUAGE  Eg. COBOL, FORTRAN, C, etc  Imp. Focus: Problem  Solution: Provided with Functions and Procedures  How: Hierarchical Decomposition  Writes list of instructions / action / flowcharts  But, we least concerned about data and its flow.  Risk for global multi-procedural data.  Not Secure  Vulnerable to accidental modifications of data.  Bugs may creep in  Do not model real life problems well
  • 15.
    STRUCTURE OF PROCEDURAL LANGAUGE MainProgram Function 1 Function 2 Function 3 Function 4 Function 5 Function 6
  • 16.
    CHARACTERISTICS  Emphasis onAlgorithm  Divide and Rule (small program as function)  Share global data  Data movement is open in function  Function transform data  Top Down Approach
  • 17.
    RELATIONSHIP OF DATAAND FUNCTION IN PROCEDURAL LANG Global Data Global Data Function 1 Local Data Function 2 Local Data Function 3 Local Data
  • 18.
    OBJECT ORIENTED PROGRAMMING LANGUAGE Here, data is critical element  Data does not flow freely in program  Function – Data coupling is tight  Protection from accidental modifications  Decomposition of problem into #objects / entries.  These objects are using function built data.  Functions of objects can communicate.
  • 19.
    ORGANIZATION OF DATA& FUNCTION IN OOP Data Function Object A Data Function Object B Data Function Object C Function of objects Communicate.
  • 20.
    CHARACTERISTICS  Emphasis onData  Programs are divided into objects  Data characterized by objects tied with functions  Data is hidden  Way of communication is through functions  New Data and Functions can be created easily.  Follow bottom up approach.
  • 21.
    BASICS OF OOP Objects Classes Data Abstraction& Encapsulation Inheritance Dynamic Binding Polymorphism Message Passing
  • 22.
    OBJECTS  Basic RuntimeEntities  Customer, Account, Objects  Bank balance is data.  Balance sheet is a function.  Object has data and code (function).  See next fig.
  • 23.
  • 24.
    CLASSES  Entire setof object’s data and code can be defined as user defined data-type called “class”.  Objects are variables of type class.  Class is a collection of objects.  Eg. Mango, apple, orange are objects of class “Fruits”.
  • 25.
    DATA ABSTRACTION & ENCAPSULATION Wrapping of data and function into single class is “Encapsulation”.  Data is secure once encapsulated in class.  Functions connect class and object.  Avoiding data access other than class is facilitating “data hiding”.  “Abstraction” is representing essential features without including background information / explanation.  Abstract information / attributes eg. Size, cost, length, etc.  Abstraction is done using data members as they hold information.  Classes are also called ADT: Abstract Data Types
  • 26.
    INHERITANCE  Reusability  Class features canbe inherited to other classes  Tailoring of features is also possible Bird: Feather Eggs Flying Bird: Size of Wings Non Flying Birds: Weight Robin Kiwi Swallow Penguin
  • 27.
    POLYMORPHISM  Operation exhibitdifferent behavior based on provided type of data.  Eg. Add(num1,num2) does addition Add(str1,str2) does concatenation  Obtained by operator or function overloading.  Allow different internal structures to use same external interface  Also used in implementing inheritance  Done preferably using Function Overloading.
  • 28.
  • 29.
    DYNAMIC BINDING  Alsocalled Late binding  Dynamically, draw a procedure that will take actions based on type of object provided.  Same as figure, if circle is provided, draws circle.
  • 30.
    MESSAGE PASSING  Amessage for an object is a request for execution of a procedure and therefore will invoke function that generates result.  Steps:  Create Class (create members, functions)  Create Objects  Communication happens using functions to obtain desired results. Employee.salary(name) Object Message Information
  • 31.
    BENEFITS OF OOP Greater productivity, better quality of s/w, less maintenance.  Inheritance: Code Reusability and reduced redundancy  Reuse of standard working modules, save time.  Data Hiding: Secure  Multiple instance of an object can co-exist  Map Objects in problem domain  Problem partition in project based objects
  • 32.
    BENEFITS OF OOP Data center design, modeling of problem, solution implementation easy.  Bottom Up Approach  Encapsulates details  Message passing system is very simple.  Easy to manage s/w complexity  Compatible with C Language.
  • 33.
  • 35.
    APPLICATIONS: C++/C# ISUSED IN  Real-time systems  Simulations and Modeling  Object oriented Databases  Hypertext, hypermedia and expertext  Artificial Intelligence  Developing Expert Systems  Neural networks and parallel programming  Decision Support and Office Automation System  CAD Systems  Internet of Things  Embedded Programming  Compiler and Operating System development  Developing new programming language
  • 36.
    QUESTION?  What doyou think are the major issues facing the software industry?  Explain Software Evolution.  How are the data and functions are organized in OOP?  List down unique advantages of OOP.  List 20 real world objects.  List down the advantages of inheritance.  List applications of C++
  • 37.
    DIFFERENTIATE  Procedure orientedv/s Object Oriented  Object v/s Class  Data Abstraction v/s Data Encapsulation  Inheritance v/s Polymorphism  Dynamic binding v/s Message Passing
  • 38.
    THANK YOU. SEE YOUSOON. Explore more about the topic.