A method, system and computer program product for converting, at run-time,
a class of an object from a source class to a destination class. A
statement in intermediate code indicating the conversion of the object
from the source class to destination class is identified. The destination
class is determined to be polymorphic to the source class. Memory space
required for the destination class is determined to be less than or equal
to the memory space required for the source class. A class hierarchy is
traversed up and down at compile time to generate conversion code. At
runtime and via up and down traversals of the class hierarchy, the
pointer to a virtual function table (v-table) of the object is updated
from referencing the v-table of the source class to referencing the
v-table of the destination class.