学习笔记(10):c++入门到精通教程 c++11/14/17-类型转换:static_cast、reinterpret_cast等...

立即学习:https://edu.csdn.net/course/play/9186/191694?utm_source=blogtoedu

// project9.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//

#include <iostream>
using  namespace std;

int main()
{
    const int ai = 90;
    const int* pai = &ai;
    int* pai2 = const_cast<int*>(pai);
    *pai2 = 120;    //这种写值行为 属于一种为定义行为 大家最好不要这么做
    cout << ai << endl;
    cout << *pai << endl;

    return 0;
}
 

  • 1
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
王桂林老师 C++11 14 17 课件 1. Why C++ 11..........................................................................................- 1 - 1.1. C++ History...................................................................................................- 1 - 1.2. Modern C++.................................................................................................. - 1 - 1.3. 功能一览...................................................................................................... - 2 - 1.4. Why ModernC++.......................................................................................... - 2 - 2. More Concise.......................................................................................- 3 - 2.1. nullptr............................................................................................................ - 3 - 2.1.1. 入参............................................................................................................................... - 3 - 2.1.2. 返值............................................................................................................................... - 3 - 2.2. override..........................................................................................................- 4 - 2.2.1. 语义............................................................................................................................... - 4 - 2.2.2. 示例............................................................................................................................... - 4 - 2.3. final................................................................................................................- 5 - 2.3.1. 语义............................................................................................................................... - 5 - 2.3.2. 示例............................................................................................................................... - 5 - 2.3.3. 意义.........................................
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值