CPB Mailing List

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

Re: The damnedest problem?!?!?



> I don't mean to insult you, but i believe you are wrong on two
> counts...

I'm not insulted.  You are correct on both counts.

> First, AnsiString only has a single operator=() function; I can find
> no overloaded operator=() that can convert an int to a string (see
> dstring.h). The assignment works because there is a constructor for
> AnsiString which accepts an integer parameter.

Although I said it was an overloaded = operator, I was thinking in 
terms of the constructor that accepts an int.  That was the reason 
for mentioning the rhs stuff.
 
> Second, in the following code, 
> 
>   int i = 0;
>   AnsiString s;
>   s = i + 1;

Is this the way the code looked?  I was under the assumption that i 
was coming in as an AnsiString.  It was this assumption that led me 
to discuss the overloaded + operator.

You are correct that this should not produce an error.  The rhs 
should be evaluated and then an implicit call to the constructor 
should be made.

I really goofed on this one.


Michael Trier
Developer's Corner Journal
http://www.pobox.com/~dcj/journal
mailto:mtrier@pobox.com
-----------------------------
Actual News Headlines:
  Include Your Children when Baking Cookies


W Komornicki's Home Page | Main Index | Thread Index