Thursday, 11 June 2015

C++ Object Oriented Concepts

In the previous post of this tutorial we have see the need of C++ programming. One main purpose to create C++ to add object oriented features to the C. In  Object Oriented every thing in the world is like an object and it have some properties. For example if considered mobile phone as an object, them its color,size,cost etc all are its properties. That is in Object Oriented we see every thing as object and it have the following five basic principles.





  1. Abstraction 
  2. Encapsulation 
  3. Inheritance 
  4. Polymorphism
  5. Classes/Objects
If we say any language is Object Oriented, it must obey these five principles. But C++ is not purely Object Oriented, but have Object Oriented features. Because we can write a C++ program without following Object Oriented features.

Abstraction in C++


                    In Object Oriented abstraction refers to hiding some details of the program to the out side world. That is we provide only certain part of the code is visible to outside instead of entire details of project code.

           For example if you are using a car, you are driving it and you don't know how it can internally run.

Encapsulation in C++


         Another Object Oriented feature is encapsulation. That is we are grouping data and functions that work on that data into a single group called "class". So that we have clear idea which function work on which data.
 
         In procedure oriented languages this can be complex task, to identify which function works on which data.

Inheritance in C++


                                 The process of deriving the base classes properties to the derived classes are called inheritance. The base class is called parent class and derived class is called child class.By using this Object Oriented feature one can achieve the code reversibility.  

                 For example, If your parent have blue eyes, then can also get the same features.


Polymorphism in C++


              This is another  Object Oriented features that cane be achieved code re usability and we can study detail in up coming posts.   

           The word  Polymorphism is derived from the two Greek words called  " Poly" more and " Morphic"  means forms. that is Polymorphism means more forms.

          In C++ Polymorphism can be achieved by using Overloading and Overriding.

Classes or Object in C++


          In C++ everything is in the form of classes and objects. Classes provides the basic entities for any object oriented programming language, Object are the instances of classes.

0 comments :

Post a Comment

Note: only a member of this blog may post a comment.

Machine Learning

More

Advertisement

Java Tutorial

More

UGC NET CS TUTORIAL

MFCS
COA
PL-CG
DBMS
OPERATING SYSTEM
SOFTWARE ENG
DSA
TOC-CD
ARTIFICIAL INT

C Programming

More

Python Tutorial

More

Data Structures

More

computer Organization

More
Top