C++学习笔记

知识模糊点

  1. 拷贝与赋值的区别
    对象的拷贝会在初始化变量,以值的方式传递或者返回一个对象时发生;而赋值操作是在对象初始化完后,利用赋值运算符时发生的

    int a=3;   //这是拷贝操作
    
    int a;
    a=4;       //这是赋值操作
  2. 如果类成员是const、引用,或者属于某种未提供默认构造函数的类类型,我们必须通过构造函数初始化列表为这些成员提供初值。
  3. volatile variables
    in c++,the volatile keyword placed before the variable indicates that the value of a variable may change between different accesses, even if it does not appear to be modified;The keyword volatile is created for such situations and it simply stops the compiler from making any assumption about the variable. If an object is declared as volatile, every time that variable is called its value is loaded from memory.Modern hardware may suppress and reorder certain accesses thus making use of the volatile keyword alone not safe.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值