C++ question: static
所在版块:社会百科 发贴时间:2003-06-04 11:32

用户信息
复制本帖HTML代码
高亮: 今天贴 X 昨天贴 X 前天贴 X 
Expert, i have a question on static.
The partial code is as following:

[quote]
// in a class Object
...
private:
typedef void (Object::*Omf) ();
static Omf farray[3];
...
[/quote]

Here i can't understand why "static" is a must?
I have tried to remove "static" but then i get compilation error message:

menu1.cpp:17: 'void (Object::* Object::farray[3]()' is not a static member of 'class Object'

Here static seems not a lifetime issue. Thanks for you enlightenmen.
.
欢迎来到华新中文网,踊跃发帖是支持我们的最好方法!

Never frown even though tomorrow may be grey, may be blue
Who knows who will love your smile in next minute
 相关帖子 我要回复↙ ↗回到正文
C++ question: static graduating   (471 bytes , 577reads )
my thots VeryGood   (297 bytes , 391reads )
Seems to be a reason graduating   (100 bytes , 197reads )
followon question graduating   (335 bytes , 239reads )
It seems that you are confused... Flying   (363 bytes , 262reads )
OS: Sun Solaris 2.6 graduating   (57 bytes , 214reads )
1-yes, 2-no graduating   (493 bytes , 270reads )
I saw your problem. But I don't think that's the Flying   (252 bytes , 263reads )
Other source of error? graduating   (649 bytes , 261reads )
only a static member can be initialize in this way VeryGood   (53 bytes , 350reads )
Many thanks to you two. This post encloses graduating   (29 bytes , 220reads )