Results 1 to 4 of 4

Thread: operator<<

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default operator<<

    Hello,
    could anyone at first sight tell me about why this below doens't work with keyword "const" (that I guess the right way) and it works without it? thanks
    Qt Code:
    1. friend std::ostream& operator<<(std::ostream& os, const Apple& a) { // <- "const"
    2. return os << "kind = " << a.getKind().c_str() << "\t"
    3. << "weight = " << a.getWeight() << "\t" << "status = " << a.getStatus().c_str() << endl;
    4. }
    To copy to clipboard, switch view to plain text mode 
    Last edited by jacek; 10th June 2008 at 00:24. Reason: wrapped too long line
    Regards

Similar Threads

  1. operator<< and templates
    By mickey in forum General Programming
    Replies: 3
    Last Post: 30th May 2008, 17:13
  2. operator<< QString
    By kiker99 in forum Qt Programming
    Replies: 6
    Last Post: 5th May 2006, 00:23

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.