Resolved External Linkage on member function array?

Discussion in 'C++' started by Immortal Nephi, May 23, 2009.

  1. 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;
    }
    Immortal Nephi, May 23, 2009
    #1
    1. Advertising

  2. Immortal Nephi

    Ian Collins Guest

    Immortal Nephi wrote:
    > 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 };
    ^^^

    --
    Ian Collins
    Ian Collins, May 23, 2009
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Richard Hayden

    Inlines with external linkage

    Richard Hayden, Jun 29, 2004, in forum: C++
    Replies:
    47
    Views:
    1,102
    Andrey Tarasevich
    Jul 6, 2004
  2. Neno
    Replies:
    2
    Views:
    3,243
  3. Replies:
    1
    Views:
    590
    Michael DOUBEZ
    Sep 12, 2008
  4. Stanisław Findeisen

    extern "C" friend function without external linkage

    Stanisław Findeisen, Aug 25, 2010, in forum: C++
    Replies:
    2
    Views:
    2,132
    Goran Pusic
    Aug 26, 2010
  5. Nephi Immortal

    Weird Resolved Linkage

    Nephi Immortal, Dec 8, 2011, in forum: C++
    Replies:
    1
    Views:
    227
    Ian Collins
    Dec 8, 2011
Loading...

Share This Page