Home

Thanks for your help. I now have a better understand of pointer-to-
member.

However, since there are actually two ways to access class data
members: one is via plain data object pointer, the other is pointer-to-
data-member, I think this can also be expanded to class functions. At
present, among all kinds of pointers, only pointer-to-class-function-
member can be used to access class member functions. Why not allow
plain function pointer to do this. Like:
typedef void (*pfunc_t) ();
class MyClass
{
public:
void doSomething();
};
MyClass my;
pfunc_t pf = &my.doSomething;

In this case, function pointer is like a closure. I guess probably
it's because the implementation isn't easy. What's more, we can use
functors. So this may not be a problem.

previous
next

Re: pass-by-reference for template?
Re: Newbie question
Re: Python question (PyNoob)
Re: Two .exe which write in Visual C++ 6.0, can they call each otherfunctions..??
Re: command line processing question
Mimo Wszystko
Fundacja Avalon
Pajacyk
Kidprotect
Fundacja Sloneczko