[侯捷_CPP面向对象高级开发_上] 1 CPP编程简介

发布时间 2023-10-23 17:12:33作者: StarAire

1. 需要具备的基础

  • 曾经学过某种 procedural language (c)
    • 变量 variables
    • 类型 types :int、float、char、struct
    • 作用域 scope
    • 循环 loops :while、for
    • 流程控制 :if-else、switch-case
  • 知道一个程序需要编译、链接才能被执行
  • 知道如何编译和链接:如何建立一个可运行程序

2. 目标

  • 培养正规的、大气的编程习惯
  • 以良好的方式编写C++ class
    • class without pointer members
      • Complex
    • class with pointer members
      • String
  • 学习Classes之间的关系
    • 继承 inheritance
    • 复合 composition
    • 委托 delegation

3. 你将获得的代码

  • 复数

    • complex.h
    • complex-test.cpp
  • 字符串

    • string.h
    • string-test.cpp
  • 面向对象类

    • oop-demo.h
    • oop-test.cpp

4. C++的历史

  • B语言(1969)
  • C语言(1972)
  • C++语言(1983)
    • new C -> C with class -> C++
  • JAVA语言
  • C#语言

5. C++演化

  • C++ 98 (1.0)
  • C++ 03 (TR1,technical report 1)
  • C++ 11 (2.0)
  • C++ 14

大部分程序员用的都是C++ 98

  • C++
    • C++ 语言
    • C++ 标准库

6. 推荐书籍

  • 《C++ Primer》 C++编译器开发者著

  • 《The C++ PROGRAMMING LANGIAGE》 C++语言开发者著

  • 《Effective C++》英文版 中文版

  • 《THE C++ STANDARD LIBRARY》

  • 《STL源码剖析》