At Sunday 2005-01-02 00:53, you wrote:

>    I wrote:
>
>#include <cstdlib>
>#include <iostream>
>
>class PColor {
>
>   public:
>
>   unsigned char r, g, b;
>
>   void rand () {
>
>     int color = (std::rand()&0xffffff);
>
>     r = (color&0xff0000);
>     g = (color&0x00ff00);
>     b = (color&0x0000ff);
>
>   }
>
>   void print (ostream o) {

    void print (ostream& o)


>     o << r << "," << g << "," << b;
>
>   }
>
>} pcolor;
>
>int main () {
>
>   while (true) {
>
>     pcolor.rand();
>
>     pcolor.print (cout);
>
>   }
>
>   return 0;
>
>}
>
>    But when trying to compile it gives the following error:
>
>PColor.cpp: In method `ostream::ostream(const ostream &)':
>/usr/lib/gcc-lib/i386-linux/2.95.4/../../../../include/g++-3/streambuf.h:128:
>`ios::ios(const ios &)' is private
>PColor.cpp:34: within this context
>
>    How is the correct way to pass a C++ stream as a parameter?

by reference as shown above
although your compiler has a "feature" that lets you ignore putting the
proper using statements/directives in the code, strict standards
conformance requires them.
so.. add a

using namespace std;

after all of your #include



>To unsubscribe, send a blank message to
><mailto:[EMAIL PROTECTED]>.
>Yahoo! Groups Links
>
>
>
>

Victor A. Wagner Jr.      http://rudbek.com
The five most dangerous words in the English language:
               "There oughta be a law"



To unsubscribe, send a blank message to <mailto:[EMAIL PROTECTED]>.



Yahoo! Groups Links

Reply via email to