Is this not downcasting?

Posted by cambr on Stack Overflow See other posts from Stack Overflow or by cambr
Published on 2010-04-27T19:07:30Z Indexed on 2010/04/27 19:13 UTC
Read the original article Hit count: 357

Filed under:
|
|

If I do

double d = 34.56;
int i = (int)d;

Am I not "downcasting"?

OR

Is this term only used in terms of classes and objects?


I am confused because in this case we are "downcasting" from a bigger double to a smaller int, but in case of classes, we "downcast" from a smaller base class to a bigger derived class.

Aren't these two conventions, in some sense, opposite?

© Stack Overflow or respective owner

Related posts about c++

Related posts about downcasting