c++学习笔记

来源:互联网 发布:减脂 知乎 编辑:程序博客网 时间:2024/05/14 05:00

1.C++关键字:asm  do if  return try  auto   double   inline   short   typedef   bool   dynamic_cast  int   siigned typeid   break   else   long    sizeof    typename      case  enum  mutable  static  union  catch   explicit namespace

static_cast  unsigned  char   export new    struct    using      class   extern 

operator    switch  virtual   const false  private   template  void    const_cast

float     protected       this  volatile     continue   for   public   throw  

wchar_t  default       friend    register      true  while   delete  goto  

reinterpret_cast

2.c++支持两种变量初始化:1.直接初始化:把初始化式放在括号里  int value(10);

                                          2.复制初始化:用等号(=) int value=10;

直接初始化效率更高

3.C++自动初始化:函数体外初始化位0,函数体内不初始化

4.const  1.将一个变量转换成常量,必须在定义是赋值

               2.const为文件局部变量,不能在其他文件引用,如果要引用,定义时指定const变量为extern  extern  const Int value=512;

5.引用就是一个对象的别名  const引用只能用在const对象-- 

0 0
原创粉丝点击