class TSoftWareInfo
{
public:
const char * SoftwareName; //参数列表中初始化
static int Year; //类外初始化
static const char * Copyright; //类外初始化
static const int Buff[100]; //类外初始化
static const char c = '1'; //char可以直接初始化,也可在参数列表中初始化
static const int SoftwareVer = 2 ;//int可以直接初始化,也可在参数列表中初始化
const int Price; //参数列表初始化
TSoftWareInfo(char*p):SoftwareName(p)
{
}
};
const int TSoftWareInfo::Buff[100] ={0};
const char * TSoftWareInfo::Copyright = "hello";
int TSoftWareInfo::Year = 2021;
类中的static,const,static const成员初始化
最新推荐文章于 2023-09-26 17:30:03 发布