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?