Item 1: View C++ as a federation of languages |
Today's C++ is amultiparadigm programming language, one supporting a combination ofprocedural,
object-oriented,functional, generic, andmetaprogramming features. This power and flexibility make C++ a tool without equal, but can also cause some confusion. All the "proper usage" rules seem to have exceptions.
The easiest way is to view C++ not as a single language but asa federation of related languages.To make sense of C++, you have to recognize its primary sublanguages. Fortunately, there are only four:
- C Way down deep, C++ is still based on C
- Object-Oriented This part of C++ is what C with Classes was all about: classes (including constructors and destructors), encapsulation, inheritance, polymorphism, virtual functions (dynamic binding), etc.
- Template C++ This is the generic programming part of C++.
- The STL The STL is a template library
C++, then, isn't a unified language with a single set of rules; it's afederation of four sublanguages, each with its own conventions. Keep these sublanguages in mind, and you'll find that C++ is a lot easier to understand.