在VC++里有“未声明的变量”错误(我明明声明了的)
#pragmaonceclassCtestclass{public:Ctestclass(wchar_t*name,intage,boolfemale=1);~Ctest...
#pragma once
class Ctestclass
{
public:
Ctestclass(wchar_t *name,int age,bool female=1);
~Ctestclass();
Ctestclass(const Ctestclass& a);
int GetAge();
bool GetFemale();
private:
wchar_t *mwname;
int miage; //这里声明了一个变量
bool mbfemale; //这里也声明了一个变量
};
Ctestclass::Ctestclass(wchar_t *name,int age,bool female)
{
miage = age;
mwname = new wchar_t(wcslen(name)*sizeof(wchar_t));
_tcscpy_s(mwname,wcslen(name)*sizeof(wchar_t),name);
mbfemale = female;
}
int Ctestclass::GetAge()
{
return miage; //这句可以通过
}
bool GetFemale()
{
return mbfemale;//错误,mbfemale未声明的标志符,请问是怎么 回事呀?
} 展开
class Ctestclass
{
public:
Ctestclass(wchar_t *name,int age,bool female=1);
~Ctestclass();
Ctestclass(const Ctestclass& a);
int GetAge();
bool GetFemale();
private:
wchar_t *mwname;
int miage; //这里声明了一个变量
bool mbfemale; //这里也声明了一个变量
};
Ctestclass::Ctestclass(wchar_t *name,int age,bool female)
{
miage = age;
mwname = new wchar_t(wcslen(name)*sizeof(wchar_t));
_tcscpy_s(mwname,wcslen(name)*sizeof(wchar_t),name);
mbfemale = female;
}
int Ctestclass::GetAge()
{
return miage; //这句可以通过
}
bool GetFemale()
{
return mbfemale;//错误,mbfemale未声明的标志符,请问是怎么 回事呀?
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询