OOP1.1 and 1.2
OOP1.1 and 1.2
2. Large Programs are divided into Functions. 2. Large Programs is divided into objects.
5. I/O Operations are carried out by printf() & scanf() 5. I/O Operations are carried out by cin & cout
functions . functions.
Function 1
Function 2
Function 3
What is Object Oriented Programming
(OOP)?
1. Object-Oriented Programming is a methodology or paradigm to design a program using classes
and objects.
2. Class:A Class is a user-defined data type that has data members and member functions.
3. Data members are the data variables and member functions are the functions used to
manipulate these variables together these data members and member functions define the
properties and behavior of the objects in a Class.
4. Class in C++ is a blueprint representing a group of objects which shares some common properties
and behaviors.
POP verses OOP
POP OOP
1. It Stands for Procedure Oriented Programming. 1. It Stands for Object Oriented Programming.
2. In this Programs are divided into small Functions. 2. In this Programs are divided into objects.
4. POP is having less Secure feature. 4. OOP is having high Security feature.
6. Example of POP Languages are :C, Fortan,Pascal. 6. Example of OOP languages are : C++, Java, Python .
Features of OOP:
1. OOP Focuses more on data(variables).
2. In this Large programs are divided into objects.
3. It follows bottom up approach for program designing.
4. Objects can communicate with each other through functions.
5. New data and functions can be easily added.
6. Data is hidden and cannot be access by external functions.
Concepts of Object Oriented Programming
Language
ABSTRACTION
INHERITANCE
OBJECTS
CLASSES
Class:
1. It is a combination of member variables and member functions.
2. It also includes objects.
3. Classes are user defined data type.
4. Objects are variables of type class.
Class
Data
variables
Example
1.class Student
of Class
class name
2. {
3. public:
4. int id; //field or data member
5. float salary; //field or data member
6. String name;//field or data member
7. } ;
Objects:
1. It is a runtime entity.
2. Object can represent user defined data.It can be a person , time,place,etc.
3. By using object user can access member variables and member functions of the class.
4. Objects can communicate with each other by sending message without having details of each
other.
Example of Class and Objects
#include <iostream>
#include<conio.h>
class Student
public:
int main()
s1.id = 201;
cout<<s1.id<<endl;
cout<<s1.name<<endl;
return 0;
};
Abstraction :
1. Abstraction means displaying only essential information and hiding the details.
2. Data abstraction refers to providing only essential information about the data to the outside
world, hiding the background details or implementation.
Polymorphism:
1. The word “polymorphism” means having many forms. In simple words, we can define
polymorphism as the ability of a message to be displayed in more than one form.
2. Types of Polymorphism:
1. Compile-time Polymorphism 2. Runtime Polymorphism
• The ability to take more than one form is called as a
polymorphism.
That is one name and multiple forms.
Shape
Class class
data data
function function
Examples of Object Oriented Languages
C++
C#
Java
Python
Applications of OOP:
1. OOP is used in Design real time system
2. Simulation & Modelling
3. Artificial Intelligence & Expert System
4. Neural network applications
5. Automation
6. Mobile computing
7. Image processing