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.
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
QUALITY ISSUES
HOW TOEVALUATE A SYSTEM
(DEVELOPED SOFTWARE)?
Correctness
Maintainability
Reusability
Interoperability
Integrity
Portability
User
Friendly
Security
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
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.
OBJECTS
Basic RuntimeEntities
Customer, Account, Objects
Bank balance is data.
Balance sheet is a function.
Object has data and code (function).
See next fig.
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.
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.
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