Usually (i.e. if you are not using RTTI), the program does not know this kind of thing (although the compiler is very strict to check it to avoid errors). The program code simply executes "as if", that is, if you wrote code that uses the float variable, then it will execute floating point instructions for any value that it loads from the corresponding memory address.
If you use RTTI (runtime type information), then the compiler stores a lot of additional information in the executable file, which also allows you to determine the type at runtime.
Finally, with virtual inheritance, vtable stores type information (although not directly accessible). For each type of object (not for each object, but for the type, that is, for all objects), the compiler generates a special "transition table" that allows you to correctly display overloaded functions. You donβt know about it, and you donβt see anything from him, but he "will just work." However, this is some type of information, implicitly.
Damon
source share