Basic Concept of object oriented in C++

Introduction about object oriented :

There are some limitation in procedural programming due to which the object oriented programmin is develop.when we discussed about object oriented programming language then cames several concept which are listed below:

1.)  Class

2.) Object

3.) Abstraction

4.) Encapsulation

5.) Inheritance

6.) Polymorphism

7.) Dynamic Binding

8.)Massage Passing

These are Basic eight Concept of Object Oriented programming.More powerful concept from this is

1.) Abstraction

2.) Encapsulation

3.) Polymorphism

4.) Inheritance


Class is a group of object with some attribute and common behavior .For example an object is you.Now,you have certain properties (attributes) like your name age, height etc and certain behavior function like you have some style walking,speaking,eating.Similar your friend Ram and Sham has also certain properties like age,name,height etc and certain behavior like walking ,speaking,eating etc. All these people represent different object having same properties and behavior.So,all these object are grouped together to form a class “Person”thus to conclude a class is a collection of similar type of object.


Object are use to model real word entities that we find in every day life.An object can be a person,place,thingb concept or everything you see in the real world .Some common example of an object include car,book,clock,e.t.c .So,an object is real word entities and also occupy the space in memory.


The art of concentrating on essential information and ignoring  non-relevant details.Abstraction refers to the act of representing essential features without including the background details or explanations.

Human manages complexity through abstraction. For example, people do not think of a bus as asset of individual parts. They thing of it as well defined object with its own unique features and behavior. This abstraction, allows people to use a bus on overwhelmed by the complexity of the parts forms the bus.  They can ignore the details how engine and braking system works. Instead, they are free to utilize the object as a whole for their purpose.

A powerful way to manage abstraction is through the use of hierarchical classifications.


Encapsulation is used to hide unimportant implementation details from other objects. Thus, the implementation details can change at any time without affecting other parts of the program. Changes in the data are allowed only through the methods of the objects.

Encapsulation is the mechanism that binds together code and data manipulates, and keeps safe from outside interference and misuse. One way to think about encapsulation is as a protective wrapper that prevents the code and data from being arbitrarily accessed by the other code defined outside the wrapper. Access to the code and data inside the wrapper is tightly controlled through a well-defined interface.


If there is need to introduce additional features in the existing devices, such as washing machine T.V or transistor radio, the company most probably does not create a blueprint. It will just work on the old blueprint and improve on that. Same happens in Oops. To create a class that has some additional states or methods, we just reuse the class that is available. In C++, classes are reused via the concept of inheritance. When a new class is created by inheriting an existing class, the new class becomes a derived class of the existing one. The existing class is a base class of the new class. The derived class can define additional data and methods. If the base class has a method that the derived class wants to change it can do it.

Inheritance derived class getting all the data and methods from thee base class.Inheritance is the process by which one object acquires the properties of another object.Inheritance is an integral part of C++ and OOP languages in general.When you inherit, you are saying, ”this new class is like the old class.”While inheriting, you are not restricted to the interface of the base class. You can also add new methods to the interface.Once, a class has been written, created and debugged it, can be distributed to other programmers for use in their own programs. This is called reusability.


When we refer to an object, we have to use a name. Generic terms for these names are called variables. We can call our T.V as Tomy. Tomy then is variable used to refer to the actual object. A variable must be declared to be of a certain class. In OOP, a variable of a base class can refer to an object of the derived class type (derived class of the class type).but the derived class could have new methods and data that the base class does not have. Well, the interpreter will use the methods of the objects, regardless of the class type of the object.

Polymorphism, means many forms, is a feature that allows one function to be used, foe a general class of actions. The specific action is determined by the exact nature of the situation. Consider a stack, you might have a program that requires three types of stacks. One stack is used for integer values, one for floating point values and one for character.

For example, the human baby’s sense of touch is polymorphic. If the mother touches her baby, the baby will smile but if some outsider touches the baby will cry.

This same general concept can be implemented in C++ as it applies to functions with in a C++ program. when you send a message to an object, even though you don’t know what specific type it is, the right thing happens, that’s called polymorphism. polymorphism is one of the crucial features of OOP,s it means one name, many forms. The overload member function is selected for invoking by matching arguments(by type, number and sequence). This information is known to the compiler at compile type and therefor, compiler is able to select the appropriate function for a  particular call at the compile time itself which is called static or early binding. It is also known as compile time polymorphism. Early binding simply means that a object is bound to its function call at compile time. The process used by object-oriented programming languages to implement polymorphism is called dynamic binding. The compiler and run time system handle the details. All you need to know is that it happens and more importantly how to design.

Some language require that you  use a special keyword to enable dynamic binding. In C++ this machanism is called as virtual function. In programming languages without polymorphism for functions, we cannot declare these two functions because the name would be doubly defined.

Without polymorphism for functions, functions defined with similar names would be ambiguous. However, if the language would take the parameter of the function into account it would work. Thus, functions (or methods) are uniquely identify by: the name of the function (or method) and the types of  its parameter list.

Dynamic Binding:

The dynamic binding is also known as late binding .In dynamic binding the linking of function call to the code of the function to be executed in response to the  function call is to made at run time known as “Dynamic binding

Message Passing

An object-oriented program , consists of a set of objects that communicate with each other.The process of programming in a  object-oriented language therefore involves the following basic steps:

  1. Creating classes that define objects and their behavior.
  2. Creating objects from class definitions.
  3. Establishing communication among objects.

Objects communicate with each other by sending and receiving information      in the same way as people pass messages to each other. The concept of message passing , make it easier to talk about building systems that directly model or simulate their real-world counterparts.

A message for an object is a request for execution of a procedure, and  therefore will invoke a function (procedure) that generates the desired result. Message passing involves specifying the name of the object, the name of the function (message) and the information to be sent.


Comments are closed.