If i cast an object to the base type and store it in a std::map, and then get it back and recast it to the derived type, do i still have the correct data in the derived class members ?
Do i need to make a specific kind of cast ?
If i cast an object to the base type and store it in a std::map, and then get it back and recast it to the derived type, do i still have the correct data in the derived class members ?
Do i need to make a specific kind of cast ?
If you're casting pointers to the object, it's no problem because the pointers will still point to the same object.
If you're casting the actual object, all information from the subclass will be lost when its converted to the superclass, so casting it back won't restore that information.