Sie sind auf Seite 1von 3

Procedure oriented programming(POP)

------------------------------------------
Conventinal programming using high level languages such as
cobol,fortran and c is commonly known as procedure oriented programming(pop).in the
procedure oriented approach the problem is viewed as a sequence of things to be
done such as reading,calculating and printing.

Characteristics of pop
1. Emphasis is on doing things(algorithms).
2. large programs are divided into smaller programs known as functions
3. most of the functions share global data .
4. data move openly around the system from function to function
5. functions transform data from one form to another.
6. employs top-down approach in program design

oop(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 accidential modification from outside
functions.
oop allows decomposition of a problem into a number of entities called
objects and then builds data and functions around these objects. the functions of
one object can access the functions of other objects.
Features of oop:
1. emphasis is on data rather than procedure.
2. programs are divided into what are known as objects.
3. data structures are designed such that they characterize the obejcts.
4. Functions that operate on the data of an object are tied together in the Data
structure.
5. data is hidden and cann't be accessed by external functions.
6. objects may communicate with each other through functions
7. new data functions can be easily added whenever necessary.

concepts of oop
1. Objects
2. Classes
3. Data Abstraction and Encapsulation
4. Inheritance
5. polymorphism
6. dynamic binding
7. message passing

1. objects
Objects are the basic run time entities in an object oriented system.
programming problem is analyzed interms of objects and the nature of communication
between them.
obejcts take up space in the memory and have an associated address.
when a program is executed the obejcts interact by sending messages to one
another.each object contains data and code to manipulate the data.

object is the physical existance of the class


object contains data and code of a class

2. Classes.
Objects contain data and code to manipulate the data.the entire set
of data and code of an object can be made a user defined data type with the help of
a class.
Objects are variables of the type class. once a class has been defined,we can
create any number of obejcts belonging to that class.
each object is associated with the data of type class with which they are
created. a class is a thus a collection of objects of similar type.

3. Data abstraction and Encapsulation


The Wrapping up of data and functions into a single unit(called class) is
known as Encapsulation.
The data is not accessible to the outside world and only those functions
which are wrapped in the class can access it. these functions provide the interface
between the objects data and the program. this insulation of the data from direct
access by the program is called Data Hiding or Information Hiding.
Abstraction refers to the act of representing essentional features with
out including the background details.
classes use the concept of abstraction and defined as a list of abstract
attributes such as size,weight and cost and functions operate on these attributes.
the attributes are some times called data members because they hold information.
the functions that operate on these data are some times called methods or member
functions.

4. Inheritance
Inheritance is the process by which objects of one class
acquire the properties of objects of another class. the concept of inheritance
provides the idea of Reusability.
5. Polymorphism
It is Another important oop concept.
polymorphism means the ability to take more than one form.
the behavior depends upon the types of data used in the operation.
the process of making an operation to exhibit different behaviours
in different instances is known as operator overloading.

6. Dynamic Binding
Binding refers to the linking of a procedure call to the code to be executed
in response to call. dynamic binding means that the code associated with a given
procedure call is not known until the time of the call at run time. it is
associated with polymorphism or inheritance. a function call associated with a
polymorphism reference depends on the dynamic type of that reference.

7. Message Passing
An Object oriented program consists of a set of objects communicate with each
other.

The process of programming in an oop language is


1. Creating classes that define objects and their behavior .
2. Creating objects from class definition.
3. Establishing communication among objects.
4.objects communication with each other by sending and receiving information.

Access Specifiers
--------------------
There are 3 types of Access Specifiers
1. private
2. public
3. protected

1. private
A key Feature of oop is data hiding. the primary mechanism for hiding data is to
put it in a class and make it private. private data or private member functions can
only be accessed from within the class.

2. public
public data or public member functions can only be accessed from outside the
class. usually the data within a class is private and the functions are public.
the data is hidden so it will be safe from accidental manipulation,while the
fuctions that operate on the data are public so they can be accessed from outside
the class.
3. protected
it is just like private. but it is used in derived classes.
a protected member can be accessed by member functions in its class or in any
derived class from its own class.any data or functions that the derived classes
might need to access should be made protected rather than private.

syntax of a class

class <class_name>
{
private:
// Data members
// member functions
public:
// data members
// member functions
};

C++ was developed by Bijarne Stroupstrup in the year 1980.


Earlier it was called as C with classess later on it became c++.

Das könnte Ihnen auch gefallen