E
enzo
hi all,
could anyone explain me why this doesn't compile??
#include<iostream>
using namespace std;
class test;
class messenger
{
public:
messenger(void(test::*p_f)() = 0)
: m_f(p_f)
{
}
void
call()
{
(*this.*m_f)();
}
void
set(void(test::*p_f)())
{
m_f = p_f;
}
void (test::*m_f)();
};
class test
{
public:
test()
: m(0)
{
m.set(&test::f);
}
void f()
{
cout << "Hallo! " << endl;
}
messenger m;
};
int
main()
{
test a;
a.m.call();
return 1;
}
thanks
e
~
could anyone explain me why this doesn't compile??
#include<iostream>
using namespace std;
class test;
class messenger
{
public:
messenger(void(test::*p_f)() = 0)
: m_f(p_f)
{
}
void
call()
{
(*this.*m_f)();
}
void
set(void(test::*p_f)())
{
m_f = p_f;
}
void (test::*m_f)();
};
class test
{
public:
test()
: m(0)
{
m.set(&test::f);
}
void f()
{
cout << "Hallo! " << endl;
}
messenger m;
};
int
main()
{
test a;
a.m.call();
return 1;
}
thanks
e
~