A Brief History of C++
- The history of C++ begins with C. The reason for this is easy to understand: C++ is built upon the foundation of C. Thus, C++ is a superset of C.
- C++ expanded and enhanced the C language to support object-oriented programming (which is described later in this module).
- C++ also added several other improvements to the C language, including an extended set of library routines. However, much of the spirit and flavor of C++ is directly inherited from C. Therefore, to fully understand and appreciate C++, you need to understand the “how and why” behind C.
- C++ is regarded as a middle-level language, as it comprises a combination of both high-level and low-level language features.
- The C++ programming language was created by Bjarne Stroustrup and his team at Bell Laboratories (AT&T, USA) to help implement simulation projects in an object-oriented and efficient way. The earliest versions, which were originally referred to as “C with classes,” date back to 1980. As the name C++ implies, C++ was derived from the C programming language: ++ is the increment operator in C.
Characteristics of C++
C++ is not a purely object-oriented language but a hybrid that contains the functionality of the C programming language. This means that you have all the features that are available in C:
- Universally usable modular programs
- Efficient, close to the machine programming
- Portable programs for various platforms.
Central to C++ is object-oriented programming (OOP). As just explained, OOP was the impetus for the creation of C++. Because of this, it is useful to understand OOP’s basic principles before you write even a simple C++ program.
Object-oriented programming offers several major advantages to software development:
- Reduced susceptibility to errors: an object controls access to its own data. More specifically, an object can reject erroneous access attempts.
- Easy re-use: objects maintain themselves and can therefore be used as building blocks for other programs.
- Low maintenance requirement: an object type can modify its own internal data representation without requiring changes to the application.
A First Simple Program
/* This is a simple C++ program. Call this file Sample.cpp. */
using namespace std;
// A C++ program begins at main().
cout << "C++ is power programming.";
/* When run, the program displays the following output:*/
C++ is power programming.