Resolved External Linkage on member function array?

I

Immortal Nephi

I create a data member which holds an array of member functions. I am
unable to link properly, but I did see member functions are already
defined. Please take a look.

class A
{
public:
A();
~A();

static void ( A::* const pF[2] )();

void A1();
void A2();
};

void ( A::* const pF[2] )() = { &A::A1, &A::A2 };

A::A() {}
A::~A() {}
void A::A1() {}
void A::A2() {}


// Start MPU 65xx program here
int main()
{
A a;

( a.* ( a.pF[0] ) )();
( a.* ( a.pF[1] ) )();

return 0;
}
 
I

Ian Collins

Immortal said:
I create a data member which holds an array of member functions. I am
unable to link properly, but I did see member functions are already
defined. Please take a look.

class A
{
public:
A();
~A();

static void ( A::* const pF[2] )();

void A1();
void A2();
};

void ( A::* const pF[2] )() = { &A::A1, &A::A2 };

void ( A::* const A::pF[2] )() = { &A::A1, &A::A2 };
^^^
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,188
Latest member
Crypto TaxSoftware

Latest Threads

Top