#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) {
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?
To unsubscribe, send a blank message to <mailto:[EMAIL PROTECTED]>.
Yahoo! Groups Links
- To visit your group on the web, go to:
http://groups.yahoo.com/group/c-prog/
- To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
- Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
