On Sat, 16 Feb 2008 13:32:08 -0700, Jerry Coffin
wrote:
>In article
>lilith@dcccd.edu says...
>
>[ ... ]
>
>> Essentially I have a context in which at makes
>> sense to have a class object return an integer value when the object's
>> name is used.
>>
>> class X {
>>
>> int XNumber;
>
>[ ... ]
>
>operator int() { return XNumber; }
>
>Keep in mind that this allows implicit conversion of an X to an int,
>even when you may not want that. Conversion operators can be handy, but
>they can also be somewhat dangerous.
Many thanks. I anticipated the hazard and have tried think of an
instance where this might be a problem but at this time I can't.
However, I'll be on the alert as I progress through this development
and if it presents a problem I'll go the less intuitive route.
Once more, thanks.
--
Lilith