Unit I Oopm
Unit I Oopm
Indore
UNIT 1
Topics to be cover:
1. Introduction to Object Oriented Thinking,
2. Concept of Object Oriented Programming,
3. Comparison POP with OOP,
4. Features of Object oriented paradigm,
5. Merits and demerits of OO methodology,
6. Object model,
7. Elements of OOPS,
8. IO processing
Overview of Programming
Programming :- Programming language is Artificial human
created language which translates instructions from
human readable to computer readable format.
Function-4 Function-5
The main aim of OOP is to bind together the data and the
functions that operate on them so that no other part of
the code can access this data except that function.
Java,
JavaScript,
Python,
C++,
Visual Basic,
.NET,
Ruby,
PHP etc.
Advantages of OOP
S
no. Top Down approach Bottom Up approach
The top-down approach focuses The bottom-up approach first
on breaking down a big problem focuses on solving the smaller
1. into smaller and understandable problems at the fundamental level
chunks and then integrating them into a
whole and complete solution.
Mainly used by structured Mainly used by object oriented
2. programming language such as programming language such as C++,
COBOL, FORTAN, C etc. C#, Python.
Each part is programmed Redundancy is minimized by using
3. separately therefore contain data encapsulation and data hiding.
redundancy.
In top down approach, In bottom up approach composition
4. decomposition takes place. takes place.
Difference between POP and OOP
S Procedure Oriented Programming Object Oriented Programming
no.
In POP, program is divided into In OOP, program is divided into
1 small parts called functions. parts called objects.
In POP, Importance is not given In OOP, Importance is given to
to data but to functions as well the data rather than procedures
2 as sequence of actions to be or functions because it works as
done. a real world.
In POP, Data can move freely In OOP, objects can move and
5 from function to function in the communicate with each other
system. through member functions.
Difference between POP and OOP
S Procedure Oriented Programming Object Oriented Programming
No.
To add new data and function in OOP provides an easy way to add
6 POP is not so easy. new data and function.
In POP, Most function uses Global In OOP, data cannot move easily
data for sharing that can be from function to function, it can
7 accessed freely from function to be kept public or private so we can
function in the system. control the access of data.
POP does not have any proper way OOP provides Data Hiding so
8 for hiding data so it is less secure. provides more security.
The main aim of OOP is to bind together the data and the
functions that operate on them so that no other part of
the code can access this data except that function.
Features of Object Oriented paradigm
1. Objects
2. Class
3. Encapsulation
4. Abstraction
5. Polymorphism
6. Inheritance
7. Dynamic Binding
8. Message Passing
1. Objects
An Object is an identifiable entity with some characteristics and
behavior. 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 person
{
char name[20];
int id;
public:
void getdetails()
};
int main()
{
person p1; // p1 is a object
}
2. Class
Itis 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.
For functions, it means that matching the call with the right
function definition by the compiler. It takes place either at
compile time or at runtime.
Static-Binding:
• OOP: We extend the car class with a Nissan class and add
methods for each set of unique information for that car
make.
Scenario 3: We found a bug in the transmission type area
of our form and need to fix it.
3) GUIDs
4) Reference counting
1. Major Elements
2. Minor Elements
1. Major Elements− By major, it is meant that if a model
does not have any one of these elements, it ceases to be
object oriented.
A. Abstraction
B. Encapsulation
C. Modularity
D. Hierarchy
A. Abstraction:
A. Typing
B. Concurrency
C. Persistence
A. Typing:
C++ IO is provided in
headers <iostream> (which
included <ios>, <istream>, <ostream> and
<streambuf>), <fstream> (for file IO),
and <sstream> (for string IO).
C++ provides both
the formatted and unformatted IO functions.
Rather than ignore the users key press, the data is put
into an input stream, where it will wait until the program
is ready for it.
2. Output streams