how do you declare pointer to such nested member function?

Discussion in 'C++' started by Mike Wahler, Mar 25, 2007.

  1. Mike Wahler

    Mike Wahler Guest

    "r.z." <> wrote in message
    news:eu4is0$48l$...
    > class A
    > {
    > public:
    > vector<B> vector_of_Bs;
    > };
    >
    > class B
    > {
    > public:
    > void some_function(void);
    > };
    >
    > How would you declare a pointer to some_function in one of Bs from
    > vector_of_Bs in A? Please be understanding.


    Same way as you would if it wasn't in a vector.

    -Mike
    Mike Wahler, Mar 25, 2007
    #1
    1. Advertising

  2. Mike Wahler

    r.z. Guest

    class A
    {
    public:
    vector<B> vector_of_Bs;
    };

    class B
    {
    public:
    void some_function(void);
    };

    How would you declare a pointer to some_function in one of Bs from
    vector_of_Bs in A? Please be understanding.
    r.z., Mar 25, 2007
    #2
    1. Advertising

  3. Mike Wahler

    r.z. Guest


    > Same way as you would if it wasn't in a vector.
    >


    and that is how?:)
    r.z., Mar 25, 2007
    #3
  4. Mike Wahler

    r.z. Guest

    >> class A
    >> {
    >> public:
    >> vector<B> vector_of_Bs;
    >> };
    >>
    >> class B
    >> {
    >> public:
    >> void some_function(void);
    >> };
    >>


    void (A::B::*pointer_to_some_function) (void);

    is that OK?
    r.z., Mar 25, 2007
    #4
  5. On 2007-03-25 03:56, r.z. wrote:
    >>> class A
    >>> {
    >>> public:
    >>> vector<B> vector_of_Bs;
    >>> };
    >>>
    >>> class B
    >>> {
    >>> public:
    >>> void some_function(void);
    >>> };
    >>>

    >
    > void (A::B::*pointer_to_some_function) (void);
    >
    > is that OK?


    No, B is not in A, just instances of it.

    void (B::*pointer_to_some_function) (void);

    --
    Erik Wikström
    =?ISO-8859-1?Q?Erik_Wikstr=F6m?=, Mar 25, 2007
    #5
    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. Newsgroup - Ann
    Replies:
    5
    Views:
    589
    John Carson
    Jul 30, 2003
  2. slide_o_mix
    Replies:
    0
    Views:
    407
    slide_o_mix
    Oct 15, 2003
  3. Alex
    Replies:
    0
    Views:
    379
  4. Fraser Ross
    Replies:
    4
    Views:
    1,026
    Fraser Ross
    Aug 14, 2004
  5. somenath
    Replies:
    2
    Views:
    146
    somenath
    Aug 29, 2013
Loading...

Share This Page