社区
C++ 语言
帖子详情
在线等:How do you call a regular member function from a static member function?
cxq249
2004-11-12 12:43:48
如题。
...全文
173
6
打赏
收藏
在线等:How do you call a regular member function from a static member function?
如题。
复制链接
扫一扫
分享
转发到动态
举报
AI
作业
写回复
配置赞助广告
用AI写文章
6 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
qrlvls
2004-11-12
打赏
举报
回复
an object pointer.
Example:
staticFunc((CClassName*)this);
pObj->m_memberFunc();
qrlvls
2004-11-12
打赏
举报
回复
I will call the member functions by passing a object pointer.
Ailaxya
2004-11-12
打赏
举报
回复
class a{
static void fun(LPARAM param);
void Callfun();
}
void a::CallFun()
{
}
void a::fun(LPARAM param)
{
a *pThis = dynamic_cast<a*>param;
pThis->CallFun();
}
fallhunter
2004-11-12
打赏
举报
回复
to
liuleilover(Vietor)
3,请问静态对象怎么实现?
static么?那还是要用到对象指针吧,请教了
cxq249
2004-11-12
打赏
举报
回复
刚开始学,不太懂。
liuleilover
2004-11-12
打赏
举报
回复
简单,在静态成员函数参数中传递一个类指针就像this。这样静态成员函数就没意义了。:-)
简单2,将那个regular member 定义成静态的。
简单3,将整个类只实现一个静态对象,在静态成员函数中直接引用。
看来是个新手!
How do I pass a pointer-to-
member
-
function
to a signal handler, X event callback, system call that s
Don't.
Because a
member
function
is meaningless without an object to invoke it on, you can't do this directly (if The X Window System was rewritten in C++, it would probably pass references to objects around, not just pointers to fu
C++之函数指针
[33.1] Is the type of "pointer-to-
member
-
function
" different from "pointer-to-
function
"? Yep. Consider the following
function
: int f(char a, float b); The type of this
function
is different dep
HowTo: Export C++ classes from a DLL
HowTo: Export C++ classes from a DLL By Alex Blekhman, 13 Nov 2012 4.91 (103 votes) Is your email address OK? You are signed up f
[33] Pointers to
member
function
s
FAQs in section [33]: [33.1] Is the type of "pointer-to-
member
-
function
" different from "pointer-to-
function
"? [33.2] How do I pass a pointer-to-
member
-
function
to a signal handler, X even
C++ 语言
65,186
社区成员
250,526
社区内容
发帖
与我相关
我的任务
C++ 语言
C++ 语言相关问题讨论,技术干货分享,前沿动态等
复制链接
扫一扫
分享
社区描述
C++ 语言相关问题讨论,技术干货分享,前沿动态等
c++
技术论坛(原bbs)
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
请不要发布与C++技术无关的贴子
请不要发布与技术无关的招聘、广告的帖子
请尽可能的描述清楚你的问题,如果涉及到代码请尽可能的格式化一下
试试用AI创作助手写篇文章吧
+ 用AI写文章