Está en la página 1de 13

Drawbacks of procedure oriented programming

The complexity increases as the programs grow larger

and complex. It does not model real world objects as close to user perspective as possible

A language or technique is object-oriented if and only

if it directly supports:
Abstraction - providing some form of classes and

objects. Inheritance - providing the ability to build new abstractions out of existing ones. Runtime polymorphism - providing some form of runtime binding.

Procedure Oriented Programming Focus is on procedures rather than the data

Object Oriented Programming Focus is on the data rather than the procedure

Data is not secured as it freely moves from one procedure to another


Employs top-down programming design It does not model the real worlds object Programs are decomposed into functions

Data is secured
Employs bottom-up programming design It models the real worlds objects Programs are decomposed into objects

Objects

Classes
Data Abstraction and Encapsulation Inheritance

Polymorphism

An object is a component of a program that knows

how to perform certain actions and to interact with other pieces of the program. Objects can know how to do more than one specific task, and they can store their own set of data. Designing a program with objects allows a programmer to model the program after the real world. Objects can interact without having to know the details of each others data.

A class is a definition of an object.

A class resembles a struct with just one difference : all

struct members are public by default. All classes members are private. A class is a type, and an object of this class is just a variable. Features of Class:
Classes contain data known as members and member

functions. As a unit, the collection of members and member functions is an object. Therefore, this unit of objects makes up a class.

It is a process of representing the essential features

without including implementation details. The abstraction says what it does: it says nothing about how it does it. It is a process of exposing only the interfaces and hiding the implementation details from the user. The interface exposed will remain the same: even if the internal implementation changes.

En + Capsulate = in a capsule

Encapsulation is the grouping together of data and

functionality. It is the process of combining data and functions into a single unit called class. By this method one cannot access the data directly. Data is accessible only through the functions present inside the class. Thus Data Encapsulation gave rise to the important concept of data hiding. It is the mechanism whereby the implementation details of a class are kept hidden from the user.

Inheritance is a mechanism of reusing and extending

existing classes without modifying them, i.e. objects of one class acquire the properties and functionality of objects of another class, thus producing hierarchical relationships between them. One reason to use inheritance is that it allows you to reuse code from a previous project but gives you the flexibility to slightly modify it if the old code doesnt do exactly what you need for the new project.

Poly = Many, Morph = Forms

polymorphism means that some code or operations or

objects behave differently in different contexts. In C++, that type of polymorphism is called overloading.

http://www.cplusplus.com/

http://en.wikipedia.org/wiki/Object-

oriented_programming Object Oriented Programming With C++ -E. Balguruswamy

Thank you

También podría gustarte