Effective C++阅读笔记(2)Item 1: View C++ as a federation of languages

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

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

                           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

Keep these four sublanguages in mind

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.




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值