C++ – The classic Object Oriented Programming Language

C++ is/was and will be one of the classic and ever-green object oriented programming language built for the pure purpose of creating strongly typed, object oriented, secured and highly efficient programs. C++ was developed by Bjarne Stroustrup by blending C language (procedural) with the object oriented features of Simula67. The first draft of ANSI standard for C++ came in Januray 25th 1994. C++ allows programs to be structured for clarity, extensibility & ease of maintenance without loss of efficiency. Eventhough C++ is an extended version of C, there is a great difference in programming with C and C++ as C++ uses the Object Oriented programming concepts such as Classes, Objects, Encapsulation, Inheritance, Polymorphism, etc. which are new to a programmer who has probably just finished his C or a similar programming course and has started to look at C++ to start off his next level.

C++ is the perfect choice of an object oriented programming language that implements the 3 pillars of object oriented programming languages – Encapsulation that protects data and operations from outside interference via objects, Polymorphism that allows for single methods and multiple signatures and also interfaces to reduce code duplication & coupling and perform a general class of actions and Inheritance that allows for representing a problem domain as a hierarchy of classifications and also reduces code duplication by extending the parent class.

We may write a C++ program in C style. But will be as viewing a color TY in black and white. C++ has many extended features and there is great deviation in style and approach of programming which gives a new dimension in programming with C++.

To start with, lets see a simple program C++ to accept some inputs and display it on the screen –

# include <iostream.h>
main() {
      int i;
      float s;
      double p;

      cout << "Please enter an int, float, double:";
      cin  >> i >> s >> p;
      char t[20];
      cout << "Please enter a string";
      cin >> t;
      cout << i << " " << s << " " << p <<" "<<t;
      return 0;

The above looks very similar to C and is procedural and is there is not much object oriented in it. It simple accepts integer, float, double an string and outputs it. Note the different operators for accepting and outputing values. Check back for more advanced articles on C++ and other programming languages.