Code:
3d_object triangle(10,40,50);
triangle.draw();
Eeewwww! (How does the triangle draw itself?)
Code:
3d_object triangle(10,40,50);
cout<<triangle;
Eeewwww! (Why would this do anything other than print "3d_object(10,40,50)"?)
What's wrong with your restated premise?
Code:
rendering_context my_context;
// ...
polygon triangle; (triangle(), 0.0f, 1.0f, 0.0f, -1.0f, -1.0f, 0.0f, 1.0f, -1.0f, 0.0f);
// ...
my_context << triangle;
Don't make objects do things they weren't born to do by subverting free functions with the operators' names.
Soma