From: Sam S. <sam...@gm...> - 2006-04-28 03:53:47
|
I ran into another C++ quirk while working on TikiSnake. If you look at the code, you'll see that I have to have my Drawable be an actual object, not a pointer, otherwise C++ complains about my overloaded << operator. The following works fine: ConsoleText ct(blah); ct << "Hello world!"; But the following doesn't: ConsoleText *ct = new ConsoleText(blah); ct << "Hello world!"; /Users/sam/Projects/Console/src/snake.cpp:73: error: invalid operands of types 'Tiki::GL::ConsoleText*' and 'const char [13]' to binary 'operator<<' You can do: *ct << "Hello world"; But the syntax looks a little quirky. Is there a way to tweak my declaration of the << operator to allow it to work through a pointer? -Sam |