Operator Overloading

From: James Angi (jamesangi_at_cox.net)
Date: 02/23/05


Date: Wed, 23 Feb 2005 00:42:50 -0500

I have a question on operator overloading that I can't find an answer to in
several guides (even google has failed me).

I'm currently making my way through several C++ guides, trying to become
familiar with the language's features. The book I'm in the middle of right
now says an operator+ function cannot be const. For example, it seems to
imply:

class String {
public:
    String operator+(const String&) const;
};

is invalid... yet it compiles, works fine, and while I realize that this
does not mean it is 'correct', I can't think of a reason why an operator+
method could not be declared const.

Thanks,
James



Relevant Pages

  • Re: Operator Overloading
    ... > several guides (even google has failed me). ... > now says an operator+ function cannot be const. ...
    (comp.lang.cpp)
  • Re: Google Search
    ... Quick Source Guides are clear, concise, user-friendly ... cuts and tips on how to use many popular software ... using a Google search. ... >Most instructions given by MVPs are over my head. ...
    (microsoft.public.security.virus)
  • Re: Sources for car spraying guides
    ... I was wondering if anyone knew of any guides for car painting (panels, ... Been flicking through google ... Any links to guides and online resources would be much appreciated. ...
    (uk.rec.cars.maintenance)
  • Re: fc4->fc5 upgrade
    ... looking to jump from fc4->fc5 i've seen different guides from google.. ... yum upgrade from fc4->fc5 ... ...the Sin of Stupidity. ...
    (Fedora)
  • Re: Who supports Clay?
    ... Clear you browser cache and look again. ... Unless you're following a cached Google link or looking through an archived copy they're still down. ... The links to individual repair guides have been removed from the main page. ... If you follow a link like http://www.pinrepair.com/bally/index1.htm from Google it gives you the login page. ...
    (rec.games.pinball)