logo
  • 教程列表
  • SO官方文档
  • 变量声明关键字
    • decltype
    • 常量
    • 签
    • 无符号
    • 挥发物
  1. StackOverflow 文档
  2. C++ 教程
  3. 变量声明关键字
  4. 常量

常量

Created: November-22, 2018

类型说明符; 应用于类型时,生成该类型的 const 限定版本。有关 const 含义的详细信息,请参阅 const 关键字 。

const int x = 123;
x = 456;    // error
int& r = x; // error

struct S {
    void f();
    void g() const;
};
const S s;
s.f(); // error
s.g(); // OK
  • 签
  • decltype

Copyright © 2018. All right reserved

tastones.com 备案号:鲁ICP备18045372号-1

  • 关于我们
  • 免责声明