C++ is a compiled general purpose
programming language. The main objective of C++ programming is to add object
orientated features to C programming language, which is in itself one of the
most powerful programming languages.
C++ was designed by a Danish
computer scientist, Bjarne Stroustrup. He began his work on C++'s predecessor
"C with Classes" in 1979. In 1985, the first edition of the C++
Programming Language was released and the first commercial implementation of
C++ was released in October of the same year. In 1989, C++ 2.0 was released
followed by the updated second edition of the C++ Programming Language in 1991.
In 2011, C++11 was released which
added more features and enlarged the standard library further, providing more
facilities for C++ programmers to use. C++ was standardized by the International Organization for
Standardization (ISO), which the
latest having being ratified and published by ISO in September 2011 as ISO/IEC
14882:2011 (informally known as C++11).
The concept of object-oriented
programming is to create an object, in code, that has certain properties and
methods. For example, a car is an object which has certain properties such as
color, doors...etc. It also has certain methods such as accelerate, brake, and
so on.
Major
features of object-oriented programming include:
- Object : C++ introduces object-oriented programming (OOP) features to C. It offers classes, which provide the four features commonly present in OOP languages: abstraction, encapsulation, inheritance, and polymorphism. This is the basic unit of object oriented programming. That is both data and function that operate on data are bundled as a unit called as object.
- Class : A class is an extensible program-code-template for creating objects, providing initial values for state (member variables) and implementations of behavior (member functions, methods).
- Abstraction : It is the process of separating ideas from specific instances of those ideas at work ie. providing only essential information to the outside world and hiding their background details.
- Encapsulation : Encapsulation is the hiding of information to ensure that data structures and operators are used as intended and to make the usage model more obvious to the developer. While working with procedural languages, it is not always clear which functions work on which variables but object-oriented programming provides you framework to place the data and the relevant functions together in the same object.
- Inheritance : Inheritance is, when an object or class is based on another object or class, using the same implementation or specifying implementation to maintain the same behavior. It is a mechanism for code reuse and to allow independent extensions of the original software via public classes and interfaces.
- Polymorphism : It enables one common interface for many implementations, and for objects to act differently under different circumstances. In other words, giving different meaning or functions to the operators or functions is called polymorphism.