0% found this document useful (0 votes)
26 views21 pages

OOP1.1 and 1.2

Presentation

Uploaded by

antarasartale11
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
26 views21 pages

OOP1.1 and 1.2

Presentation

Uploaded by

antarasartale11
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 21

Object Oriented

Programming Using C++


UNIT 1- PRINCIPLES OF OBJECT ORIENTED
PROGRAMMING
1.1 AND 1.2
Contents
1. Difference between C and C++.
2. What is Procedure Oriented Programming ? (POP)
3. What is Object Oriented Programming ? (OOP)
4. Procedure Oriented Programming (POP) verses Object Oriented Programming(OOP).
5. Examples of Object Oriented languages.
6. Applications of OOP.
Difference between C and C++
C C++
1. It is Procedure Oriented Programming Language. 1. It is Object Oriented Programming Language.

2. Large Programs are divided into Functions. 2. Large Programs is divided into objects.

3. It Follows top down approach 3. It follows bottom up approach .

4. Variable declaration at the starting of function . 4. Variable declaration is done anywhere.

5. I/O Operations are carried out by printf() & scanf() 5. I/O Operations are carried out by cin & cout
functions . functions.

6. Not Support Inheritance Concept 6. Support Inheritance Concept .


What is Procedure Oriented Programming(POP)
?
1. Procedural Programming is a Programming model derived from Structural Programming .
2. It follows the concepts of calling Procedures.
3. The procedures, also called functions consist of a series of computational steps that they need to
carry out.
4. Examples of procedural programming are FORTRAN, ALGOL, COBOL, BASIC, Pascal, and C.
Procedural

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.

3.In POP , more Focus is on Functions . 3. In OOP ,more focus is on Data.

4. POP is having less Secure feature. 4. OOP is having high Security feature.

5. POP follows Top down Approach 5. OOP follows Bottom up approach

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

ENCAPSULATION OOPS POLYMORPHISM

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 id;//data member (also instance variable)


Output:
201
string name;//data member(also instance variable)
Jaiswal
};

int main()

Student s1; //creating an object of Student

s1.id = 201;

s1.name = " Jaiswal";

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

Circle Square Rectangle Triangle


Inheritance:
1. In C++, inheritance is a process in which one object acquires all the properties and behaviors of its parent
object automatically.
2. Its like Parent child relationship.
3. In C++, the class which inherits the members of another class is called derived class and the class whose
members are inherited is called base class.
4. Types of Inheritance:
1. Single Inheritance.
2. Multiple Inheritance.
3. Multilevel Inheritance.
4. Hierarchical Inheritance.
5. Hybrid Inheritance.
Encapsulation:
1. Encapsulation is a process of combining member functions and data members in a single unit
called a class.
2. It is one of the popular features of Object-Oriented Programming(OOPs), which helps in data
hiding.
Dynamic binding:
1. The linking of Procedure (function) call at runtime is called as dynamic binding.
2. It is also called as late binding.
3. Dynamic binding is achieved by virtual functions.
Message Passing:
1. Communication between functions for accessing data.
2. Communications between functions can be done through object.

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

You might also like