C++ question: static
登录 | 论坛导航 -> 华新鲜事 -> 社会百科 | 本帖共有 11 楼,当前显示第 5 楼 : 从楼主开始阅读 : 本帖树形列表 : 返回上一页
作者:graduating (等级:4 - 马马虎虎,发帖:562) 发表:2003-06-04 15:54:50  5楼 
It seems that you are confused...1) The sample you gave above is NOT a declaration of member function. Instead, the typdef statement simply aliases a data type of member function pointer as "Omf" for the ease of reference. 2) No matter farray is declared as static or not, the syntax is acceptable! That is, there is NO compelling reason that farray must be declared static. Please double check.
1-yes, 2-no
I agree with your first point. It is really just aliasing. I had mis-used some words such as static functions. It is not private function. farray is a pointer to array of functions. farray is a private member of class Object.
So the problem is that the keyword static is not allowed to be omitted, otherwise compiler complains as shown in the error message
[quote]
menu1.cpp:17: 'void (Object::* Object::farray[3]()' is not a static member of 'class Object'
[/quote]
So you see the problem?
Never frown even though tomorrow may be grey, may be blue
Who knows who will love your smile in next minute
欢迎来到华新中文网,踊跃发帖是支持我们的最好方法!原文 / 传统版 / WAP版只看此人从这里展开收起列表

本帖共有 11 楼,当前显示第 5 楼,本文还有 N-1 层楼,要不你试试看:点击此处阅读更多 >>



请登录后回复:帐号   密码