class Person
{
private:
int age;
static const int height = 10;
public:
Person();
~Person();
Person(const Person& per);
void print();
};
我把static const int height = 10; 这句改为:static const float height = 10; ,,系统提示:only static const integral data members can be initialized within a class难道把int改为float,,,就不再是静态的了,,谁帮忙解释下
{
private:
int age;
static const int height = 10;
public:
Person();
~Person();
Person(const Person& per);
void print();
};
我把static const int height = 10; 这句改为:static const float height = 10; ,,系统提示:only static const integral data members can be initialized within a class难道把int改为float,,,就不再是静态的了,,谁帮忙解释下
解决方案 »
- 请教一个关于API函数的问题
- 无惊无险又到5点,下班!everybody happy holiday!
- 请问如何在ListBox 用DrawItem 自绘背景图片
- 请问用vc 如何写一个聊天室的聊天记录程序呢?如果使用代理服务器怎么写呢?非常急!跪谢!
- extern const int *pi; 是声明还是定义, 晕了。 extern int *pi; 是定义还是声明。
- nicn诚招VC++ C语言开发测试高手
- 串口一次发送1万个双精度数据问题?
- 为什么创建了Button控件不能用?(在线等)
- 高手请进,发现了很多内存泄漏的问题,请教解决此问题的办法,捎带送点分
- 惭愧,惭愧呀,人家在学校就搞了个APP FRAME,自己呢?怎麽差距就这麽大呢
- SDI工程下创建CWnd窗体显示有误,而且不能响应鼠标消息,两天没解决了,CSDN中法帖也没有想要的答案,好心人指教,谢谢,抢分了,在线等待,急.
- CListCtrl的OnCustomDraw问题,高分求教
int Person::height = 10;
但是改为static const float height = 10;就出错了
难道改为float以后就不是静态的了吗??
xx.h
class CTest
{
...
private:
static float m_fTest;
}xx.cpp
float CTest::m_fTest = 0.0;