Professional Documents
Culture Documents
Unit-1
Presented by
Er.
Assistant Professor
Applied Science(CSE)
Chandigarh University
Gharuan (Mohali).
1
C vs C++
• C- Structured programming became very popular and
was the main technique of the1980.
• Structured programming enable programmers to write
moderately complex programs fairly easily. However as
the programs grew larger, even the structured approach
failed to show the desired results in terms of bug-free,
easy-to-maintain and reusable programs.
C vs C++
• -Object-Oriented Programming (OOP) is an approach
to program organization and development that
attempts to eliminate some of the pitfalls of
conventional programming methods by incorporating
the best of structured programming features with
several powerful new concepts.
Procedure-Oriented Programming
• Conventional programming using high level language
such as COBOL, FORTRAN and C is commonly known
as Procedure oriented programming.
• In the Procedure oriented approach the problem is
viewed as a sequence of things to bed one such as
reading, calculating and printing.
• The primary focus is on functions.
Structure of Procedure-oriented
Procedure-Oriented Programming
• Procedure-Oriented Programming
• Procedure oriented programming basically consists
of writing a list of instructions for the computer to
follow and organizing these instructions into groups
known as functions.
• We normally use a flow chart to organize these
actions and represent the flow of control from one
action to another.
• More importance to functions very little attention to
data that are being used by the functions.
Structure of Procedure-oriented
Procedure-Oriented Programming
• In multi-function program many important data
items are placed as global so that they may be
accessed by all the functions. Each function may
have its own local data.
• In large program it is very difficult to identify what
data is used by which function. In case we need to
revise an external data structure we also need to
revise all function that access it.
Object-Oriented Programming
• OOP treats data as a critical element in the program
development and does not allow it to flow freely
around the system.
• It ties data more closely to the functions that operate
on it, and protects it from accidental modification
from outside functions
• OOP allows decomposition of a problem into a
number of entites called objects
Organization of data & function OOP
Striking features of OOP
• Emphasis is on data rather than procedure.
• Programs are divided in to what are known as
objects
• Functions that operate on the data of an object are
tied together in the data structure
• Data is hidden and can not be accessed by external
functions
• Objects may communicate with each other through
functions
Difference between Procedure oriented Programming and
Object Oriented Programming
Data Access In POP, Most function In OOP, data can not move
uses Global data for easily from function to
sharing that can be function,it can be kept
accessed freely from public or private so we can
function to function in the control the access of data.
system.
Data Hiding POP does not have any OOP provides Data
proper way for hiding Hiding so provides more
data so it is less secure. security.
class name {
attributes and
declarations symbolic constants
17
Sample class
#include<iostream.h>
class Pencil
{
public String color = “red”;
public int length;
public float diameter;
setcolor(string);