help-gplusplus
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: overloaded ops << and >>


From: Thomas Maeder
Subject: Re: overloaded ops << and >>
Date: Fri, 01 Jul 2005 01:02:29 +0200
User-agent: Gnus/5.1006 (Gnus v5.10.6) XEmacs/21.4 (Jumbo Shrimp, linux)

jalkadir@gosonic.ca writes:

> I have a class that overloads the inserter and the extractor
> operators, but there is a problem with the way I worte the methods;
> because the compiler does not like it at all.
>
> This is the snip of what the problem looks like:
>
> --- money.hpp
> friend std::ostream& std::operator<<( std::ostream&, const jme::Money&);
> friend std::istream& std::operator>>( std::istream&, jme::Money& );

We mere users are not allowed to extend the namespace std like this.

Better add these operators to namespace jme. Argument-dependent lookup
will find them when they are used.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]