The Promise of C++: Reusable Class Libraries

C++ is a powerful language in its own right, but its real value lies in its ability to be extended with class libraries. These already-written libraries of C++ classes appear as though they were part of the language.

As an example, consider the familiar C and C++ data type int:

int i = 5;

i += 3; // i = 8

Now suppose you had a class library that included a “string” data type called CString. You could write expressions such as:

CString s = "very";

s += " easy"; // s = "very easy"

Notice how the CString data type, called a “class,” appears to be part of the language.

As another example, consider the cout object introduced in the C++ Tutorial. An expression such as:

cout << "i = " << i << "\n";

depends on the Microsoft iostream Class Library because the << operator, normally used for shifting left, has been overloaded to insert values into the output stream cout.