Problem with passing vector of pointers to objects to member function of another object
I have a vector of pointers to Mouse objects called 'mice'.
I'm passing the mice to the cat by reference.

    vector <Mouse*> mice;
    Cat * c;
    
    c->lookForMouse(&mice);

And here's my lookForMouse() member function

    void Cat::lookForMouse(vector <Mouse*> *mice)
    {
      ...
    }

And now to the problem!  Within the function above, I can't seem to access my mice.  This below will not work

    mice[i]->isActive();

The error message I receive suggests to use mice[i].isActive(), but this throws an error saying	isActive() is not a member of std::vector<_Ty> ...

This works though...

    vector <Mouse*> miceCopy = *mice;
    miceCopy[i]->isActive();

I understand that I shouldn't be creating another vector of mice here, it defeats the whole point of passing it by reference  (let me know if I'm wrong)...

Why can't I do mice[i]->isActive() What should I be doing?

Thanks for your time and help :D

James.

Problem with passing vector of pointers to objects to member function of another object
===

I have a vector of pointers to Mouse objects called 'mice'.
I'm passing the mice to the cat by reference.

    vector <Mouse*> mice;
    Cat * c;
    
    c->lookForMouse(&mice);

And here's my lookForMouse() member function

    void Cat::lookForMouse(vector <Mouse*> *mice)
    {
      ...
    }

And now to the problem!  Within the function above, I can't seem to access my mice.  This below will not work

    mice[i]->isActive();

The error message I receive suggests to use mice[i].isActive(), but this throws an error saying	isActive() is not a member of std::vector<_Ty> ...

This works though...

    vector <Mouse*> miceCopy = *mice;
    miceCopy[i]->isActive();

I understand that I shouldn't be creating another vector of mice here, it defeats the whole point of passing it by reference  (let me know if I'm wrong)...

Why can't I do mice[i]->isActive() What should I be doing?

Thanks for your time and help :D

James.
