passing ref to ptr again as ref to ptr....

Discussion in 'C++' started by osama178@gmail.com, Apr 24, 2008.

  1. Guest

    Let's say I have this code

    --------------------
    class GenericQueue
    {
    bool Pop(void*& refToPtr); // //--------------------(1)


    };

    class SpecialQueue: private GenericQueue
    {
    public:
    bool Pop(T*& refToPtr)
    {
    return GenericQueue::pop(refToPtr); //--------------------(2)
    }

    };

    ..... The statement in (2) generates an error.

    I know it doesn't compile because we're passing a pointer in (2) to a
    function that expects a reference to a pointer, but as soon as we go
    into the code block in (2), refToPtr becomes just the pointer. How do
    I get it as a reference to pointer so I can pass it correctly?

    Thanks
    , Apr 24, 2008
    #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. Sid
    Replies:
    5
    Views:
    1,065
  2. Heiko Vogel
    Replies:
    3
    Views:
    548
    Method Man
    Sep 14, 2004
  3. franco ziade

    const ptr to const ptr ?

    franco ziade, Feb 17, 2005, in forum: C Programming
    Replies:
    3
    Views:
    387
    franco ziade
    Feb 17, 2005
  4. Replies:
    22
    Views:
    741
    peter koch
    Apr 30, 2008
  5. Replies:
    6
    Views:
    334
    James Kanze
    Apr 29, 2008
Loading...

Share This Page