Q
qwert
Hello,
how do I convert types? Something like the following, but it is not possible
in Java:
Object objObject = (String) "No integer";
int intTemp;
try
{
intTemp = (int) objObject; // Suppose to cause exception....(this line
doesn't compile)
}
catch
{
intTemp = 0;
}
Basicly, I have an object which can contain any type and a set of functions
that must convert it to a specific type. If the conversion is not possible,
the functions must return a default value,
thanks for any info.
how do I convert types? Something like the following, but it is not possible
in Java:
Object objObject = (String) "No integer";
int intTemp;
try
{
intTemp = (int) objObject; // Suppose to cause exception....(this line
doesn't compile)
}
catch
{
intTemp = 0;
}
Basicly, I have an object which can contain any type and a set of functions
that must convert it to a specific type. If the conversion is not possible,
the functions must return a default value,
thanks for any info.