第一章:从连续世界到可计算存在
2025/12/21 17:55:17
1、类名冒号后面用来定义类的继承。
classCAboutDlg:publicCDialog{public:CAboutDlg();enum{IDD=IDD_ABOUTBOX};protected:virtualvoidDoDataExchange(CDataExchange*pDX);protected:DECLARE_MESSAGE_MAP()};2、构造函数后面加冒号用来初始化成员列表。
3、表示结构内的位域(该变量占几个bit空间)。
typedefstruct_XXX{unsignedchara:4;//a占4个bit空间unsignedcharc;};XXX1、局部变量使用同名的全局变量。
#include<iostream>usingnamespacestd;intintValue=8;intmain(){intintValue=9;::intValue++;cout<<::intValue<<endl;cout<<intValue<<endl;while(1);}2、调用API函数。
3、域操作符。
在类B声明一个函数void fun(),但是没给出具体类的定义,在类外定义是要写成void B::fun():
classB{public:voidfun();}voidB::fun(){...}4、表示引用成员函数及变量,作用域成员运算符:System::Math::Sqrt()相当于System.Math.Sqrt()。