'Converts the current object into an object of a different class. The
new class must use the ASN.1 encoding for the value.
:param other_class:
The class to instantiate the new object from
:return:
An instance of the type other_class'

def cast(self, other_class):

    if (other_class.tag != self.__class__.tag):
        raise TypeError(unwrap(u'\n                                                                Can    not    covert    a    value    from    %s    object    to    %s    object    since    they\n                                                                use    different    tags:    %d    versus    %d\n                                                                ', type_name(other_class), type_name(self), other_class.tag, self.__class__.tag))
    new_obj = other_class()
    new_obj.tag_type = self.tag_type
    new_obj.class_ = self.class_
    new_obj.explicit_class = self.explicit_class
    new_obj.explicit_tag = self.explicit_tag
    new_obj._header = self._header
    new_obj.contents = self.contents
    new_obj._trailer = self._trailer
    if isinstance(self, Constructable):
        new_obj.method = self.method
        new_obj._indefinite = self._indefinite
    return new_obj
