Friday 29 July 2016

What is OPP

OPP stands for  Object Oriented Programming .
It is a programming Tecnique in Which programs are written on the basis of objects . Objects may represent a person , thing or place of real world .

Opp is a powerfull tecnique to Build Software . It is used to analyze and and design the applications in terms of Objects .

Object-oriented programming requires a different way
of thinking and adds several new concepts to programming:
» You analyze the objects with which you are working—both the attributes of those objects







and the tasks that need to be performed with and on those objects.
» You pass messages to objects, requesting the objects to take action.
» The same message works differently (and appropriately) when applied to the various
objects.
» A method can work appropriately with different types of data it receives, without the
need for separate method names.
» Objects can assume or inherit traits of previously created objects, thereby reducing the
time it takes to create new objects.
» Information hiding is more complete than in procedural programs.
The basic principles behind using object-oriented programming techniques involve:
» Objects
» Classes
» Inheritance
» Polymorphism 

OBJECTS AND CLASSES
It is difficult to discuss objects without mentioning classes; it is equally difficult to discuss
classes without bringing up objects. An object is any thing. A class consists of a category of
things. An object is a specific item that belongs to a class; it is called an instance of a class. A
class defines the characteristics of its objects and the methods that can be applied to its objects.


For example, Dish is a class. You know that you can hold a Dish object in your hand, that you
can eat from a Dish, and that you can wash it. Dish objects have attributes like size and color.
They also have methods like fill and wash. myBlueCerealBowl is an object and a member
of—or a specific instance of—the Dish class. This situation is considered an is-a relationship
because you can say, “myBlueCerealBowl is a Dish.” For example, yourBlueCerealBowl

is another instance of the Dish class, as is myPewterSaladPlate. Because myBlueCerealBowl,
yourBlueCerealBowl, and myPewterSaladPlate are examples of a Dish, they share
characteristics. Each has a size and color; each can be filled and washed.
If I tell you I am buying my grandmother a scarletWindsor, you probably have no way of
organizing its characteristics in your brain. Is it something you eat? Is it a piece of clothing? If
I tell you a scarletWindsor “is a” Dish, you have a beginning frame of reference because of
your knowledge of the Dish class in general. If it “is a” Dish, you assume it has a size and
color and that it can be filled and washed.
Similarly, each button on the toolbar of a word-processing program is an instance of a
Button class, and each button shares some general characteristics that all buttons possess.
Even if you have never used a particular piece of software before, if you are presented with
a screen containing a button, you know how to use it.
In a program used to manage a hotel, thePenthouse and theBridalSuite are specific
instances of HotelRoom. Organizing program components into classes and objects reflects a
natural way of thinking.
INHERITANCE
The concept of using classes provides a useful way to organize objects; it is especially useful
because classes are reusable. That is, you can extend them—they are extensible. You can
create new classes that extend or are descendents of existing classes. The descendent classes
can inherit all the attributes of the original (or parent) class, or they can override inappropriate
attributes.
Employing inheritance can save a lot of work; when you create a class that inherits from
another, you only need to create the new features. When an automobile company designs a
new car model, it does not build every component from scratch. The car might include a new
feature—for example, some model contained the first air bag—but many of a new car’s features
are simply modifications of existing features. The manufacturer might create a larger
gas tank or a more comfortable seat, but these new features still possess many of the properties
of their predecessors from older models. Most features of new car models are not even
modified; instead, existing components, such as air filters and windshield wipers, are
included on the new model without any changes. Similarly, you can create powerful computer
programs more easily if many of their components are used either “as is” or with slight
modifications. Inheritance does not enable you to write any programs that you could not
write if inheritance did not exist; you could create every part of a program from scratch, but
reusing existing classes and interfaces makes your job easier.


To learn C++ and Opp for free Join My fb group facebook.com/groups/iammnhamza


No comments: