Topic: int isn't a class (Was: Preincrement yields lvalue?)


Author: Valentin Bonnard <Bonnard.V@wanadoo.fr>
Date: 1999/02/18
Raw View
Siemel Naran wrote:

> Fine.  Now please explain to me why the rules for builtin types are
> different from the rules for user types.  After, I like to think
> that there exist classes like this
>    class int { ... };
>    class double { ... };

But there are no such classes. Otherwise, expressions such as
int() + double() would be ambiguous, because we have as
candidates:
- operator+ (int, int)
- operator+ (double, double)
- ...
and as conversion sequences:
- int -> double
- double -> int
- ...
and why on earth should class double be prefered over class int ?

--

Valentin Bonnard


[ comp.std.c++ is moderated.  To submit articles, try just posting with ]
[ your news-reader.  If that fails, use mailto:std-c++@ncar.ucar.edu    ]
[              --- Please see the FAQ before posting. ---               ]
[ FAQ: http://reality.sgi.com/austern_mti/std-c++/faq.html              ]