Operator Overloading
From: James Angi (jamesangi_at_cox.net)
Date: 02/23/05
- Next message: Alf P. Steinbach: "Re: Operator Overloading"
- Previous message: Kurt Stutsman: "Re: non-member function can not have 'const' method qualifier?"
- Next in thread: Alf P. Steinbach: "Re: Operator Overloading"
- Reply: Alf P. Steinbach: "Re: Operator Overloading"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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
- Next message: Alf P. Steinbach: "Re: Operator Overloading"
- Previous message: Kurt Stutsman: "Re: non-member function can not have 'const' method qualifier?"
- Next in thread: Alf P. Steinbach: "Re: Operator Overloading"
- Reply: Alf P. Steinbach: "Re: Operator Overloading"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|