exceptions and throw inside a class

Pages: 12
hmm. IF upconversions went all the way to the assignment data type or return data type or func arg data type, would a cast simply be converted? how are casts different than an automatic upconversion (for lack of a better term)?
how are casts different than an automatic upconversion
> how are casts different than an automatic upconversion

Re-read a C or C++ text book.
Alternatively, try this, and it should become clear.

1
2
3
4
double d1 = 7 / 3 ; // int/int => int; int widened to double on assignment
double d2 = double(7) / 3 ; // double/int => double; double assigned to double
double d3 = 7.0 / 3 ; // double/int => double; double assigned to double
std::cout << d1 << ' ' << d2 << ' ' << d3 << '\n' ;
Last edited on
Topic archived. No new replies allowed.
Pages: 12