重學C++之路_#1_概述_總體介紹

1.背景:

2009-2010適用C++開發了一個系統,2010-2012年適用C++對另外一個系統(通信行業)做維護、二次開發,代碼量一般,之後很久沒有適用C++,當時還在討論C++11的一些新特性,而反觀現在C++2a都要發佈了,需要學習一下對應的特性。

2.參考資料:

1.https://www.runoob.com/cplusplus/cpp-intro.html (入門)

 

3.面向對象語音的主要特點:

  • 抽象
  • 封裝
  • 繼承
  • 多態

4.瞭解歷史

標準化(源自 “菜鳥教程”)

發佈時間 通稱 備註
2017 C++17 第五個C++標準
2017 coroutines TS 協程庫擴展
2017 ranges TS 提供範圍機制
2017 library fundamentals TS 標準庫擴展
2016 concurrency TS 用於併發計算的擴展
2015 concepts TS 概念庫,用於優化編譯期信息
2015 TM TS 事務性內存操作
2015 parallelism TS 用於並行計算的擴展
2015 filesystem TS 文件系統
2014 C++14 第四個C++標準
2011 - 十進制浮點數擴展
2011 C++11 第三個C++標準
2010 - 數學函數擴展
2007 C++TR1 C++技術報告:庫擴展
2006 - C++性能技術報告
2003 C++03 第二個C++標準
1998 C++98 第一個C++標準

5.C++ 關鍵字(源自:菜鳥)

下表列出了 C++ 中的保留字。這些保留字不能作爲常量名、變量名或其他標識符名稱。

asm else new this
auto enum operator throw
bool explicit private true
break export protected try
case extern public typedef
catch false register typeid
char float reinterpret_cast typename
class for return union
const friend short unsigned
const_cast goto signed using
continue if sizeof virtual
default inline static void
delete int static_cast volatile
do long struct wchar_t
double mutable switch while
dynamic_cast namespace template  

完整關鍵字介紹可查閱:C++ 的關鍵字(保留字)完整介紹

關鍵字完成介紹:https://www.runoob.com/w3cnote/cpp-keyword-intro.html

6.部分保留字擴展:

6.1 dynamic_cast/static_cast/reinterpret_cast/const_cast:

參考:https://blog.csdn.net/u014450222/article/details/81428336

問題:

1

2

3

int i;

char *p = "This is an example.";

i = reinterpret_cast<int>(p);

指針到整數的轉換,如果適用64位編碼器,需要適用long long否則會報錯

6.2mutable:

mutalbe的中文意思是“可變的,易變的”,跟constant(既C++中的const)是反義詞

是在const 函數內對變量又有操作時,對變量設置

https://www.cnblogs.com/yongdaimi/p/9565996.html 介紹的比較好

 

7.打印地址:

本章:

版權聲明:本文爲CSDN博主「linuxwuj」的原創文章,遵循 CC 4.0 BY-SA 版權協議,轉載請附上原文出處鏈接及本聲明。
原文鏈接:https://blog.csdn.net/linuxwuj/article/details/81562661

int a = 0;
const char * p = "hello";
cout << "變量a的地址: " << &a << endl;                           // 變量a的地址
cout << "變量a的地址: " << static_cast<void *>(&a) << endl;      // 變量a的地址
cout << "字符串 " << p << endl;                                 // 字符串內容,即"hello"
cout << "字符串的地址 " << static_cast<const void *>(p) << endl; // 字符串的地址
————————————————
 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章