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.

本文深入探讨了C++作为多范式编程语言的特性,将其视为由四个核心子语言组成的联邦制。通过认识C、面向对象、泛型编程和元编程这四大组成部分,读者将发现C++的复杂性变得易于理解和管理。
3077

被折叠的 条评论
为什么被折叠?



