#include <iostream>
using namespace std;
int static staticNum = 3;
int globalNum = 4;
struct staticClass
{
static int staticClassNUm ;
int classNum = 6;
int getClassNum()
{
return staticClassNUm;
}
static int getStaticClassNum()
{
return staticClassNUm;
}
};
int staticClass::staticClassNUm = 5;
struct constClass
{
const int a = 40;
int getB()
{
return b;
}
private:
const int b =50;
};
void funcTest()
{
static int staticFuncNum = 7;
staticFuncNum = staticFuncNum + 1;
int Num = 10;
Num = Num + 1;
printf("staticFuncNum:%d \n", staticFuncNum);
printf("funcNum:%d \n", Num);
}
void static getInt()
{
static int a1 = 12;
a1 += 1;
cout <<a1<<endl;
int a2 = 20;
a2 = a2+1;
cout <<a2<<endl;
}
const int getConst()
{
return 21;
}
int main()
{
// staticClass a;
// cout <<"staticNum:"<<staticNum<<endl;
// cout <<"globalNum:"<<globalNum<<endl;
// cout <<"staticClassNUm:"<<staticClass::staticClassNUm<<endl;
// cout <<"getjClassNUm:"<<a.getClassNum()<<endl;
// cout <<"getStaticClassNum:"<<a.getStaticClassNum()<<endl;
// funcTest();
// funcTest();
// getInt();
// getInt();
//cout << 0 << endl;
int constNum = getConst();
constNum = constNum + 1;//22
constClass c;
cout <<c.a <<endl;
cout <<c.getB() <<endl;
cout <<constNum<<endl;
getchar();
return 0;
}
static
最新推荐文章于 2023-08-01 15:49:05 发布