Thread: cout used for more than just text

  1. #16
    Master Apprentice phantomotap's Avatar
    Join Date
    Jan 2008
    Posts
    5,108
    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

  2. #17
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    The whole idea behind objects is to make programming hierarchical. Typically a scene would draw an object. More over, one would typically make a console or something of the sort a part of that scene. Thus you are kind of slipping down a retarded logic slope.

  3. #18
    Registered User
    Join Date
    Jun 2008
    Posts
    266
    Yeah it might not actually be that great. Looked cool at first.

  4. #19
    Registered User
    Join Date
    Jun 2008
    Posts
    127
    No point in arguing anymore. I'll it out later and see if I like it. Thanks for all the replies.

  5. #20
    Banned master5001's Avatar
    Join Date
    Aug 2001
    Location
    Visalia, CA, USA
    Posts
    3,685
    No problemo. I like to be thanked when all I do is critique. Joking aside, we are simply trying to mold your habits, herWter. You are new to programming, obviously. If we all were lumberjacks, and Salem jumped out with a book on chainsaw safety, you would not be upset with him for looking out for you. Or if we were fire fighters, you would not get upset with matsp if he mentioned the proper proceedure for breaking a window, you would not feel like he is ruining your great idea.

    I like helping others fix their code. My favorite way to help someone is to actually just read through the code they proudly present for all of us to see and point out their missing semicolon on line 167.. you know, the line with the variable that wasn't initialized before it was used. To be more direct, we all have a harder time reading code that follows no logical sort of format.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to use FTP?
    By maxorator in forum C++ Programming
    Replies: 8
    Last Post: 11-04-2005, 03:17 PM
  2. Need Help with a Bowling Score Program
    By oobootsy1 in forum C++ Programming
    Replies: 6
    Last Post: 11-01-2005, 10:04 AM
  3. Homework due tonight! help please!!
    By Andy717 in forum C++ Programming
    Replies: 41
    Last Post: 04-07-2005, 01:18 PM
  4. how to cout colored text?
    By Guanhui in forum C++ Programming
    Replies: 1
    Last Post: 07-05-2002, 08:14 AM
  5. Ok, Structs, I need help I am not familiar with them
    By incognito in forum C++ Programming
    Replies: 7
    Last Post: 06-29-2002, 09:45 PM