c++ - Is this not downcasting? -


if do

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

am not "downcasting"?

or

is term used in terms of classes , objects?


i confused because in case "downcasting" bigger double smaller int, in case of classes, "downcast" smaller base class bigger derived class.

aren't these 2 conventions, in sense, opposite?

no, not down casting. casting, , you're chopping off after decimal.

down casting doesn't apply here. primitives int , double not objects in c++ , not related each other in way 2 objects in class hierarchy are. separate , primitive entities.

down casting refers act of casting 1 object object derives it. refers act of moving down root of class hierarchy. has nothing sizes of types in question.


Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -