Re: Pass a member function as argument before knowing which instanceof class to use.

Discussion in 'C++' started by Marcel Müller, Aug 21, 2013.

  1. On 21.08.13 16.44, Glen Stark wrote:
    > void Bar::g1(vector<token> toks)
    > {
    > for(token t : toks)
    > {
    > int key = get_key(t);
    > Foo curfoo = m_foomap[key];
    > curfoo.f1();
    > }
    > }

    (...)

    void Bar::g(vector<token> toks, void (Foo::*func)())
    {
    for(token t : toks)
    {
    int key = get_key(t);
    Foo curfoo = m_foomap[key];
    (curfoo.*func)();
    }
    }


    Marcel
     
    Marcel Müller, Aug 21, 2013
    #1
    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. Replies:
    21
    Views:
    21,600
  2. PaulSchrum
    Replies:
    4
    Views:
    662
    Thomas Fritsch
    Jan 23, 2007
  3. Ben Kial
    Replies:
    1
    Views:
    664
    Eric Enright
    Nov 15, 2004
  4. Dwight Army of Champions

    class data member or member function argument?

    Dwight Army of Champions, Feb 21, 2010, in forum: C++
    Replies:
    4
    Views:
    1,549
    tonydee
    Feb 22, 2010
  5. Melzzzzz
    Replies:
    0
    Views:
    174
    Melzzzzz
    Aug 21, 2013
Loading...

Share This Page