Well i don't think that there is a direct way to clearly distinguish what kind of datatype is stored in var, as both constructors initialize one member , leaving the other uninitialized which probably leads to an error.