Working with "&cout"

Hey guys a little rusty with c++ because i haven't done much of it in a while now. I have a question hopefully someone can help me out with. My professor wants me to have a class where i can pass &cout to it. ie:
SpyOutput (&cout);

Just wondering what the constructor look like for this??
Last edited on
That's the "address of" operator. You use it to assign pointers values. So your parameter must be a pointer to std::cout's type (a pointer to std::ostream).
I completely forgot about that. I did some googling without much luck though. This is what i did but it didn't compile so its obviously wrong SpyOutput (*std::ostream);. Any suggestions??

Ill keep searching.
SpyOutput (std::ostream*);

Remember to watch for null pointers.
I actually think i got it. I edited it and used this instead std::ostream * k. It this correct?
OK thank you filipe!
Topic archived. No new replies allowed.