C++ question: static
登录 | 论坛导航 -> 华新鲜事 -> 社会百科 | 本帖共有 11 楼,当前显示第 7 楼 : 从楼主开始阅读 : 本帖树形列表 : 返回上一页
作者:Flying (等级:18 - 华新水车,发帖:16849) 发表:2003-06-04 16:13:48  7楼  评分: 
1-yes, 2-noI 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?
I saw your problem. But I don't think that's the
point.

I compiled the following code using g++ version 2.95.2 on Solaris:

class Object {
private:
typedef void (Object::*Omf)();
/*static*/ Omf farray[3];
};

Compilation gave no error. I suppose the error was caused by other factors.
Flying @way 吳穎暉
欢迎来到华新中文网,踊跃发帖是支持我们的最好方法!原文 / 传统版 / WAP版只看此人从这里展开收起列表

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



请登录后回复:帐号   密码