C++语言笔记-1

使用书籍: A Tour of C++
作者: Bjarne Stroustrup (C++之父)

Chapter 1

  1. namespace
    1
    using namespace std;
    This way can make std visible in the current action scope. Otherwise, we need to use prefix like std::, which explicitly state the namespace.
  2. C++ can handle override function, but if there exists ambiguity in compiling the code, the compiler will throw an error. Such like:
    1
    2
    3
    int func(double d1,int i1){}
    int func(int i2,double d2){}
    int result = func(2,3);
  3. C++ sometime will do implicit conversion. Such like
    int a = 7.2, actually, 7 will be store in a.
  4. C++ allow the declaration in the form
    type name {parameter p1...}; which seems like constructor. There is no equal between name and brace.

中英名词对照

英文 中文
namespace 命名空间
action scope 作用域
brace 花括号
作者

Arthur LI

发布于

2017-08-07

更新于

2023-03-25

许可协议

评论